home *** CD-ROM | disk | FTP | other *** search
/ Deutsche Edition 2 / Deutsche Edition 2.iso / mac / PROGRAMME / MathReader 2.1 ƒ / A Sampling of Mathematica next >
Text File  |  1991-04-19  |  86KB  |  2,785 lines

  1. (*^
  2.  
  3. ::[paletteColors = 128; showRuler; 
  4.     fontset = title, inactive, nohscroll, noKeepOnOnePage, preserveAspect, groupLikeTitle, M18, N18, bold, e8,  24, "Times";
  5.     fontset = subtitle, inactive, nohscroll, noKeepOnOnePage, preserveAspect, groupLikeTitle, M18, N72, e6,  10, "Times";
  6.     fontset = subsubtitle, inactive, nohscroll, noKeepOnOnePage, preserveAspect, groupLikeTitle, M18, N5, e50,  9, "Times";
  7.     fontset = section, inactive, nohscroll, noKeepOnOnePage, preserveAspect, groupLikeSection, M18, O450, bold, a30, e8,  18, "Times";
  8.     fontset = subsection, inactive, nohscroll, noKeepOnOnePage, preserveAspect, groupLikeSection, blackBox, M18, N72, bold, a16,  14, "Times";
  9.     fontset = subsubsection, inactive, nohscroll, noKeepOnOnePage, preserveAspect, groupLikeSection, whiteBox, M18, bold, a16,  12, "Geneva";
  10.     fontset = text, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M18, N3,  12, "Times";
  11.     fontset = smalltext, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M18,  12, "Times";
  12.     fontset = input, nowordwrap, preserveAspect, groupLikeInput, M18, N23, bold, B65535,  10, "Courier";
  13.     fontset = output, output, inactive, nowordwrap, preserveAspect, groupLikeOutput, M18, N23, R6185, G15986, B40959,  10, "Courier";
  14.     fontset = message, inactive, nowordwrap, preserveAspect, groupLikeOutput, M18, N23, R65535,  10, "Courier";
  15.     fontset = print, inactive, nowordwrap, preserveAspect, groupLikeOutput, M18, N23,  10, "Courier";
  16.     fontset = info, inactive, nowordwrap, preserveAspect, groupLikeOutput, M17, N23,  10, "Courier";
  17.     fontset = postscript, PostScript, formatAsPostScript, output, inactive, nowordwrap, preserveAspect, groupLikeGraphics, M18, w253, h254,  10, "Courier";
  18.     fontset = name, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M18,  9, "LO Univers 45 LightOblique";
  19.     fontset = header, inactive, noKeepOnOnePage, preserveAspect, M0,  10, "Times";
  20.     fontset = Left Header, nohscroll, M0,  12, "Palatino";
  21.     fontset = footer, inactive, noKeepOnOnePage, preserveAspect, M0, N72,  6, "B Univers 65 Bold";
  22.     fontset = Left Footer, center, M0,  12, "Palatino";
  23.     fontset = help, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M18,  10, "Geneva";
  24.     fontset = clipboard, inactive, noKeepOnOnePage, preserveAspect, M0,  10, "New York";
  25.     fontset = completions, inactive, nowordwrap, noKeepOnOnePage, preserveAspect, M0,  10, "New York";
  26.     fontset = special1, inactive, nowordwrap, noKeepOnOnePage, preserveAspect, M0, N90, bold, L1, a2,  12, "Geneva";
  27.     fontset = special2, inactive, nowordwrap, noKeepOnOnePage, preserveAspect, blackBox, M0, N90, a2, e2,  12, "B Palatino Bold";
  28.     fontset = special3, inactive, nowordwrap, noKeepOnOnePage, preserveAspect, center, M-4,  12, "B Palatino Bold";
  29.     fontset = special4, inactive, nowordwrap, noKeepOnOnePage, preserveAspect, right, M81, bold,  12, "Geneva";
  30.     fontset = special5, inactive, nowordwrap, noKeepOnOnePage, preserveAspect, center, M81,  12, "Palatino";]
  31. :[font = title; inactive; preserveAspect; rightWrapOffset = 431; startGroup; ]
  32. A Sampling of Mathematica
  33.  
  34.  
  35. ;[s]
  36. 3:0,1;14,2;25,1;28,-1;
  37. 3:0,24,17,Courier,1,24,0,0,0;2,26,18,Times,1,24,0,0,0;1,26,18,Times,3,24,0,0,0;
  38. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  39. This file is a Mathematica Notebook that gives some examples of what Mathematica  can do.  For information on how to read this Notebook, see the file Read This First!
  40.  
  41. This file is loosely based on the ÒTour of MathematicaÓ   in Mathematica: A System for Doing Mathematics by Computer, Second Edition, by Stephen Wolfram.  This book was published by Addison-Wesley in 1991, and is available at most bookstores.  For information on how to obtain copies of Mathematica  itself, see the section ÒBuying Mathematica Ó in the file Read This First!
  42. ;[s]
  43. 18:0,0;15,1;26,0;69,1;80,0;150,2;167,0;211,1;223,0;229,1;240,0;242,1;284,0;455,1;466,0;500,1;512,0;526,2;543,-1;
  44. 3:9,14,9,Times,0,12,0,0,0;7,14,9,Times,2,12,0,0,0;2,14,9,Times,1,12,0,0,0;
  45. :[font = section; inactive; Cclosed; preserveAspect; rightWrapOffset = 431; startGroup; ]
  46. Numerical Calculations
  47. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  48. You can use Mathematica  as an enhanced scientific calculator.  Let's start with a simple example. 
  49. ;[s]
  50. 5:0,0;12,1;23,0;82,2;83,0;100,-1;
  51. 3:3,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0;1,14,9,Times,0,12,65535,0,65535;
  52. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ]
  53. 45 + 78
  54. :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ]
  55. 123
  56. ;[o]
  57. 123
  58. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  59. The first line here is what you type into Mathematica.  The second line is the result Mathematica  gives.  If you are reading this Notebook on a color system, the input and output are blue, with the input in boldface.
  60. ;[s]
  61. 5:0,0;42,1;53,0;86,1;97,0;218,-1;
  62. 2:3,14,9,Times,0,12,0,0,0;2,14,9,Times,2,12,0,0,0;
  63. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  64. Now let's try something more difficult.
  65. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ]
  66. 3^100
  67. :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ]
  68. 515377520732011331036461129765621272702107522001
  69. ;[o]
  70. 515377520732011331036461129765621272702107522001
  71. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  72. Unlike a calculator, Mathematica  gives an exact answer for 3 raised to the power 100.
  73. ;[s]
  74. 3:0,0;21,1;32,0;87,-1;
  75. 2:2,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0;
  76. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  77. Now let's really test out Mathematica.  Here is 3 raised to the power 1000.
  78. ;[s]
  79. 3:0,0;26,1;37,0;76,-1;
  80. 2:2,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0;
  81. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ]
  82. 3^1000
  83. :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ]
  84. 13220708194808066368904552597521443659654220327521481676649\
  85.  2036822682859734670489954077831385060806196390977769687258\
  86.  2355950954582100618911865342725257953674027620225198320803\
  87.  8780147742289648412743904001175886180411289478156230944380\
  88.  6156617305408667449050617812548034440554705439703889581746\
  89.  5368254916136220830268563778582290228416398307887896918556\
  90.  4040848989376093732421718463599386955167650189405881090604\
  91.  2608967143886410281435038564874716583201061436613217310276\
  92.  8902855220001
  93. ;[o]
  94. 13220708194808066368904552597521443659654220327521481676649\
  95.  
  96.  2036822682859734670489954077831385060806196390977769687258\
  97.  
  98.  2355950954582100618911865342725257953674027620225198320803\
  99.  
  100.  8780147742289648412743904001175886180411289478156230944380\
  101.  
  102.  6156617305408667449050617812548034440554705439703889581746\
  103.  
  104.  5368254916136220830268563778582290228416398307887896918556\
  105.  
  106.  4040848989376093732421718463599386955167650189405881090604\
  107.  
  108.  2608967143886410281435038564874716583201061436613217310276\
  109.  
  110.  8902855220001
  111. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  112. This took about half a second on a Macintosh II.
  113. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  114. Here's the result in the form you might get on a calculator.
  115. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ]
  116. N[%]
  117. :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ]
  118. "1.32207"*10^"477"
  119. ;[o]
  120.           477
  121. 1.32207 10
  122. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  123. Here is the value of pi to two hundred decimal places.
  124. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ]
  125. N[Pi, 200]
  126. :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ]
  127. 3.141592653589793238462643383279502884197169399375105820974\
  128.  9445923078164062862089986280348253421170679821480865132823\
  129.  0664709384460955058223172535940812848111745028410270193852\
  130.  1105559644622948954930382
  131. ;[o]
  132. 3.141592653589793238462643383279502884197169399375105820974\
  133.  
  134.  9445923078164062862089986280348253421170679821480865132823\
  135.  
  136.  0664709384460955058223172535940812848111745028410270193852\
  137.  
  138.  1105559644622948954930382
  139. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  140. Mathematica  knows about a big collection of mathematical functions Ñ most of those you would find in any book of mathematical tables.
  141. ;[s]
  142. 2:0,1;11,0;135,-1;
  143. 2:1,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0;
  144. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ]
  145. BesselJ[5, 34.6]
  146. :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ]
  147. 0.0511826
  148. ;[o]
  149. 0.0511826
  150. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ]
  151. Log[4.5 + 2I] 
  152. :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ]
  153. 1.59421 + 0.418224*I
  154. ;[o]
  155. 1.59421 + 0.418224 I
  156. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ]
  157. Zeta[1/2 + 14.3 I]
  158. :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ]
  159. -0.0119878 + 0.132231*I
  160. ;[o]
  161. -0.0119878 + 0.132231 I
  162. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  163. Mathematica  can do many kinds of exact computations with integers.  FactorInteger gives the factors of an integer.
  164. ;[s]
  165. 5:0,1;11,0;69,3;82,2;83,0;116,-1;
  166. 4:2,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0;1,14,9,Times,1,12,0,0,0;1,13,9,Courier,1,10,0,0,0;
  167. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ]
  168. FactorInteger[70612139395722186]
  169. :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ]
  170. The Unformatted text for this cell was not generated.
  171. Use options in the Actions Settings dialog box to control
  172. when Unformatted text is generated.
  173. ;[o]
  174. {{2, 1}, {3, 2}, {43, 5}, {26684839, 1}}
  175. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  176. You can also do all the standard numerical matrix computations with Mathematica.  This computes the inverse of a 2 by 2 matrix.
  177. ;[s]
  178. 3:0,0;68,1;79,0;128,-1;
  179. 2:2,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0;
  180. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ]
  181. Inverse[{{3.5, 7.2}, {-2.4, 6.4}}]
  182. :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ]
  183. The Unformatted text for this cell was not generated.
  184. Use options in the Actions Settings dialog box to control
  185. when Unformatted text is generated.
  186. ;[o]
  187. {{0.16129, -0.181452}, {0.0604839, 0.0882056}}
  188. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  189. This gives a  numerical approximation to the eigenvalues of the matrix computed in the last example. 
  190. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ]
  191. Eigenvalues[%]
  192. :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ]
  193. The Unformatted text for this cell was not generated.
  194. Use options in the Actions Settings dialog box to control
  195. when Unformatted text is generated.
  196. ;[o]
  197. {0.124748 + 0.0981812 I, 0.124748 - 0.0981812 I}
  198. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  199. Mathematica  will also solve  linear programming problems. This returns a list
  200. containing the maximum value of the Òobjective functionÓ and the point at which it is attained.
  201. ;[s]
  202. 2:0,1;11,0;175,-1;
  203. 2:1,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0;
  204. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ]
  205. ConstrainedMax[17 x -20 y + 18 z,
  206.   {x - y + z < 10, x < 5, x + z > 20}, {x, y, z}]
  207. :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; endGroup; ]
  208. The Unformatted text for this cell was not generated.
  209. Use options in the Actions Settings dialog box to control
  210. when Unformatted text is generated.
  211. ;[o]
  212. {160, {x -> 0, y -> 10, z -> 20}}
  213. :[font = section; inactive; Cclosed; preserveAspect; rightWrapOffset = 431; startGroup; ]
  214. Algebraic Calculations
  215. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  216. One of the most important features of Mathematica  is its ability to deal with mathematical formulas in algebraic form.
  217. ;[s]
  218. 3:0,0;38,1;49,0;120,-1;
  219. 2:2,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0;
  220. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ]
  221. (1 + x)^3
  222. :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ]
  223. (1 + x)^3
  224. ;[o]
  225.        3
  226. (1 + x)
  227. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  228. This is what Mathematica  does if you type in a simple algebraic expression.
  229. You can expand out the expression like this:
  230. ;[s]
  231. 3:0,0;13,1;24,0;122,-1;
  232. 2:2,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0;
  233. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ]
  234. Expand[%]
  235. :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ]
  236. 1 + 3*x + 3*x^2 + x^3
  237. ;[o]
  238.              2    3
  239. 1 + 3 x + 3 x  + x
  240. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  241. Mathematica  gives an explicit formula for the result.
  242. You can factor this result to get back to what you started from.
  243. % always stands for the last result that Mathematica  gave you.
  244. ;[s]
  245. 6:0,1;11,0;120,2;121,0;161,1;172,0;184,-1;
  246. 3:3,14,9,Times,0,12,0,0,0;2,14,9,Times,2,12,0,0,0;1,14,10,Courier,0,12,0,0,0;
  247. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ]
  248. Factor[%]
  249. :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ]
  250. (1 + x)^3
  251. ;[o]
  252.        3
  253. (1 + x)
  254. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  255. Now let's try a more complicated example.
  256. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ]
  257. (1 + 2x + 5y)^7
  258. :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ]
  259. (1 + 2*x + 5*y)^7
  260. ;[o]
  261.                7
  262. (1 + 2 x + 5 y)
  263. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ]
  264. Expand[%]
  265. :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ]
  266. 1 + 14*x + 84*x^2 + 280*x^3 + 560*x^4 + 672*x^5 + 448*x^6 + 
  267.    128*x^7 + 35*y + 420*x*y + 2100*x^2*y + 5600*x^3*y + 
  268.    8400*x^4*y + 6720*x^5*y + 2240*x^6*y + 525*y^2 + 
  269.    5250*x*y^2 + 21000*x^2*y^2 + 42000*x^3*y^2 + 42000*x^4*y^2 + 
  270.    16800*x^5*y^2 + 4375*y^3 + 35000*x*y^3 + 105000*x^2*y^3 + 
  271.    140000*x^3*y^3 + 70000*x^4*y^3 + 21875*y^4 + 131250*x*y^4 + 
  272.    262500*x^2*y^4 + 175000*x^3*y^4 + 65625*y^5 + 262500*x*y^5 + 
  273.    262500*x^2*y^5 + 109375*y^6 + 218750*x*y^6 + 78125*y^7
  274. ;[o]
  275.                2        3        4        5        6
  276. 1 + 14 x + 84 x  + 280 x  + 560 x  + 672 x  + 448 x  + 
  277.  
  278.         7                          2           3
  279.    128 x  + 35 y + 420 x y + 2100 x  y + 5600 x  y + 
  280.  
  281.          4           5           6          2           2
  282.    8400 x  y + 6720 x  y + 2240 x  y + 525 y  + 5250 x y  + 
  283.  
  284.           2  2          3  2          4  2          5  2
  285.    21000 x  y  + 42000 x  y  + 42000 x  y  + 16800 x  y  + 
  286.  
  287.          3            3           2  3           3  3
  288.    4375 y  + 35000 x y  + 105000 x  y  + 140000 x  y  + 
  289.  
  290.           4  3          4             4           2  4
  291.    70000 x  y  + 21875 y  + 131250 x y  + 262500 x  y  + 
  292.  
  293.            3  4          5             5           2  5
  294.    175000 x  y  + 65625 y  + 262500 x y  + 262500 x  y  + 
  295.  
  296.            6             6          7
  297.    109375 y  + 218750 x y  + 78125 y
  298. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ]
  299. Factor[%]
  300. :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ]
  301. (1 + 2*x + 5*y)^7
  302. ;[o]
  303.                7
  304. (1 + 2 x + 5 y)
  305. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  306. With the option setting Trig -> True Mathematica  will do algebraic operations using trigonometric identities.
  307. ;[s]
  308. 5:0,0;24,2;36,0;37,1;49,0;111,-1;
  309. 3:3,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0;1,13,9,Courier,1,10,0,0,0;
  310. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ]
  311. Expand[ Cos[x]^3 Sin[x]^2, Trig -> True]
  312. :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ]
  313. The Unformatted text for this cell was not generated.
  314. Use options in the Actions Settings dialog box to control
  315. when Unformatted text is generated.
  316. ;[o]
  317. Cos[x]   Cos[3 x]   Cos[5 x]
  318. ------ - -------- - --------
  319.   8         16         16
  320. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  321. Mathematica  also does linear algebra on symbolic matrices.
  322. ;[s]
  323. 2:0,1;12,0;60,-1;
  324. 2:1,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0;
  325. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ]
  326. Inverse[{{a, b}, {c, d}}]
  327. :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ]
  328. The Unformatted text for this cell was not generated.
  329. Use options in the Actions Settings dialog box to control
  330. when Unformatted text is generated.
  331. ;[o]
  332.        d               b
  333. {{------------, -(------------)}, 
  334.   -(b c) + a d    -(b c) + a d
  335.  
  336.           c              a
  337.   {-(------------), ------------}}
  338.      -(b c) + a d   -(b c) + a d
  339. :[font = subsection; inactive; Cclosed; preserveAspect; rightWrapOffset = 431; startGroup; ]
  340. Calculus
  341. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  342. You can use Mathematica  to do calculus. Here's a simple integral.
  343. ;[s]
  344. 3:0,0;12,1;23,0;67,-1;
  345. 2:2,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0;
  346. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ]
  347. Integrate[x^n, x]
  348. :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ]
  349. x^(1 + n)/(1 + n)
  350. ;[o]
  351.  1 + n
  352. x
  353. ------
  354. 1 + n
  355. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  356. Here's a more complicated example.
  357. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ]
  358. Integrate[x/(x^3-1), x]
  359. :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ]
  360. (3^(1/2)*ArcTan[(1 + 2*x)/3^(1/2)])/3 + Log[1 - x]/3 - 
  361.    Log[1 + x + x^2]/6
  362. ;[o]
  363.                1 + 2 x
  364. Sqrt[3] ArcTan[-------]                             2
  365.                Sqrt[3]    Log[1 - x]   Log[1 + x + x ]
  366. ----------------------- + ---------- - ---------------
  367.            3                  3               6
  368. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  369. Now let's try differentiating again.
  370. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ]
  371. D[%, x]
  372. :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ]
  373. -1/(3*(1 - x)) + 2/(3*(1 + (1 + 2*x)^2/3)) - 
  374.    (1 + 2*x)/(6*(1 + x + x^2))
  375. ;[o]
  376.    -1               2               1 + 2 x
  377. --------- + ------------------ - --------------
  378. 3 (1 - x)                   2                2
  379.                    (1 + 2 x)     6 (1 + x + x )
  380.             3 (1 + ----------)
  381.                        3
  382. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  383. This gives the expression in a different algebraic form. We can get back our original form using Simplify.
  384. ;[s]
  385. 3:0,0;97,1;105,0;107,-1;
  386. 2:2,14,9,Times,0,12,0,0,0;1,13,9,Courier,1,10,0,0,0;
  387. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ]
  388. Simplify[%]
  389. :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ]
  390. x/(-1 + x^3)
  391. ;[o]
  392.    x
  393. -------
  394.       3
  395. -1 + x
  396. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  397. Mathematica  can also give exact solutions to many definite integrals.
  398. ;[s]
  399. 2:0,1;11,0;71,-1;
  400. 2:1,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0;
  401. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ]
  402. Integrate[ Sin[x]^10 Cos[x]^5 / x^10, {x, 0, Infinity}]
  403. :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ]
  404. The Unformatted text for this cell was not generated.
  405. Use options in the Actions Settings dialog box to control
  406. when Unformatted text is generated.
  407. ;[o]
  408. 40221457 Pi
  409. -----------
  410.  297271296
  411. :[font = text; inactive; preserveAspect; ]
  412.  
  413. Here's another example.
  414. :[font = input; preserveAspect; startGroup; ]
  415. Integrate[ Log[x] (1 + x^2)^(-2), {x, 0, 1}]
  416. :[font = output; output; inactive; preserveAspect; endGroup; ]
  417. -(4*Catalan + Pi)/8
  418. ;[o]
  419. -(4 Catalan + Pi)
  420. -----------------
  421.         8
  422. :[font = text; inactive; preserveAspect; ]
  423. Most integrals found in any book of tables can be done by Mathematica.
  424. ;[s]
  425. 3:0,0;58,1;69,0;71,-1;
  426. 2:2,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0;
  427. :[font = input; preserveAspect; startGroup; ]
  428. Integrate[ Log[x]^6/(1 + x^2),  {x, 0, 1}]
  429. :[font = output; output; inactive; preserveAspect; endGroup; ]
  430. (61*Pi^7)/256
  431. ;[o]
  432.      7
  433. 61 Pi
  434. ------
  435.  256
  436. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  437. Many integrals do not have a Òclosed form solutionÓ.  If you give Mathematica  such a definite integral it will be returned unevaluated. You can still use N to get a numerical answer.
  438. ;[s]
  439. 5:0,0;66,1;77,0;155,2;156,0;184,-1;
  440. 3:3,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0;1,13,9,Times,1,10,0,0,0;
  441. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ]
  442. Integrate[ Sin[ Sin[x]], {x, 0, Pi}]
  443. :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ]
  444. The Unformatted text for this cell was not generated.
  445. Use options in the Actions Settings dialog box to control
  446. when Unformatted text is generated.
  447. ;[o]
  448. Integrate[Sin[Sin[x]], {x, 0, Pi}]
  449. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ]
  450. N[ % ]
  451. :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ]
  452. The Unformatted text for this cell was not generated.
  453. Use options in the Actions Settings dialog box to control
  454. when Unformatted text is generated.
  455. ;[o]
  456. 1.78649
  457. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  458. Mathematica  can also solve differential equations. Here is a pair of simultaneous differential equations. The solution you get involves two undetermined coefficients.
  459. ;[s]
  460. 2:0,1;11,0;168,-1;
  461. 2:1,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0;
  462. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ]
  463. DSolve[{x'[t] == -y[t], y'[t] == x[t]}, 
  464.                                 {x[t], y[t]}, t]
  465. :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ]
  466. The Unformatted text for this cell was not generated.
  467. Use options in the Actions Settings dialog box to control
  468. when Unformatted text is generated.
  469. ;[o]
  470. {{x[t] -> 
  471.  
  472.       -I t          2 I t                    2 I t
  473.      E     (C[1] + E      C[1] - I C[2] + I E      C[2])
  474.      ---------------------------------------------------, 
  475.                               2
  476.  
  477.    y[t] -> 
  478.  
  479.       -I t              2 I t                2 I t
  480.      E     (I C[1] - I E      C[1] + C[2] + E      C[2])
  481.      ---------------------------------------------------}}
  482.                               2
  483. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  484. It is a mathematical fact that most differential equations do not have an explicit symbolic solution. In these cases you can get a numerical approximation to the solution using NDSolve.  After the solution is computed it is plotted.
  485. ;[s]
  486. 3:0,0;177,1;184,0;233,-1;
  487. 2:2,14,9,Times,0,12,0,0,0;1,13,9,Courier,1,10,0,0,0;
  488. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ]
  489. NDSolve[{y''[x] + Sin[x]^2 y'[x] + y[x] == Cos[x]^2,
  490.      y[0] == 1, y'[0] == 0}, y, {x, 0, 20}]
  491. :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ]
  492. The Unformatted text for this cell was not generated.
  493. Use options in the Actions Settings dialog box to control
  494. when Unformatted text is generated.
  495. ;[o]
  496. {{y -> InterpolatingFunction[{0., 20.}, <>]}}
  497. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ]
  498. Plot[ Evaluate[ y[x] /. %], {x, 0, 20} ]
  499. :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; rightWrapOffset = 431; pictureLeft = 17; pictureWidth = 282; pictureHeight = 174; endGroup; endGroup; pictureID = 24096; ]
  500.  
  501. :[font = subsection; inactive; Cclosed; preserveAspect; rightWrapOffset = 431; startGroup; ]
  502. Solving Equations
  503. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  504. This is how you solve a quadratic equation in Mathematica.
  505. ;[s]
  506. 3:0,0;46,1;57,0;59,-1;
  507. 2:2,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0;
  508. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ]
  509. Solve[x^2 + 2 a x + 1 == 0, x]
  510. :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ]
  511. {{x -> (-2*a + (-4 + 4*a^2)^(1/2))/2}, 
  512.    {x -> (-2*a - (-4 + 4*a^2)^(1/2))/2}}
  513. ;[o]
  514.                            2
  515.        -2 a + Sqrt[-4 + 4 a ]
  516. {{x -> ----------------------}, 
  517.                  2
  518.  
  519.                              2
  520.          -2 a - Sqrt[-4 + 4 a ]
  521.    {x -> ----------------------}}
  522.                    2
  523. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  524. Here's a more complicated example.
  525. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ]
  526. Solve[x^5 + 3x + 1 == 0, x]
  527. :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ]
  528. {ToRules[Roots[3*x + x^5 == -1, x]]}
  529. ;[o]
  530.                       5
  531. {ToRules[Roots[3 x + x  == -1, x]]}
  532. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  533. It is a fact of mathematics that there is no way to get an exact formula for the solutions of a quintic equation like this.  You can nevertheless ask Mathematica  to give you numerical results.  You get the five complex number roots to the equation.
  534. ;[s]
  535. 3:0,0;150,1;162,0;250,-1;
  536. 2:2,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0;
  537. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ]
  538. N[%]
  539. :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ]
  540. {{x -> -0.839072 - 0.943852*I}, 
  541.    {x -> -0.839072 + 0.943852*I}, {x -> -0.331989}, 
  542.    {x -> 1.00507 - 0.937259*I}, {x -> 1.00507 + 0.937259*I}}
  543. ;[o]
  544. {{x -> -0.839072 - 0.943852 I}, 
  545.  
  546.    {x -> -0.839072 + 0.943852 I}, {x -> -0.331989}, 
  547.  
  548.    {x -> 1.00507 - 0.937259 I}, {x -> 1.00507 + 0.937259 I}}
  549. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  550. When equations contain complicated functions there is in general no systematic procedure for finding all solutions, even numerically.  The Mathematica  function FindRoot searches for a numerical solution to an equation, starting at a specified point. 
  551. ;[s]
  552. 5:0,0;139,1;150,0;161,2;169,0;252,-1;
  553. 3:3,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0;1,13,9,Courier,1,10,0,0,0;
  554. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ]
  555. FindRoot[{Sin[x] == x - y, Cos[y] == x + y},
  556.                          {x, 1}, {y, 0}]
  557. :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ]
  558. The Unformatted text for this cell was not generated.
  559. Use options in the Actions Settings dialog box to control
  560. when Unformatted text is generated.
  561. ;[o]
  562. {x -> 0.883402, y -> 0.1105}
  563. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  564. Mathematica  also has an efficient routine for finding the solution to linear equations. Here's a simple example.
  565. ;[s]
  566. 2:0,1;12,0;114,-1;
  567. 2:1,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0;
  568. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ]
  569. LinearSolve[{{1.02, 5.9}, {2.87, 1.9}}, {1.9, 1.06}]
  570. :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; endGroup; endGroup; ]
  571. The Unformatted text for this cell was not generated.
  572. Use options in the Actions Settings dialog box to control
  573. when Unformatted text is generated.
  574. ;[o]
  575. {0.176325, 0.291551}
  576. :[font = section; inactive; Cclosed; preserveAspect; rightWrapOffset = 431; startGroup; ]
  577. Graphics
  578. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  579. Here is a simple Mathematica  plot. 
  580. ;[s]
  581. 3:0,0;17,1;28,0;37,-1;
  582. 2:2,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0;
  583. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ]
  584. Plot[Sin[x], {x, 0, 2Pi}]
  585. :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; rightWrapOffset = 431; pictureLeft = 17; pictureWidth = 282; pictureHeight = 174; endGroup; pictureID = 27955; ]
  586.  
  587. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  588. There are many options you can specify for a plot.  Using Show you can redraw the previous plot with specified options.
  589. ;[s]
  590. 3:0,0;58,1;62,0;120,-1;
  591. 2:2,14,9,Times,0,12,0,0,0;1,13,9,Courier,1,10,0,0,0;
  592. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ]
  593. Show[% , Frame -> True, 
  594.             PlotLabel  -> "The Sine Function"]
  595. :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; rightWrapOffset = 431; pictureLeft = 17; pictureWidth = 282; pictureHeight = 174; endGroup; pictureID = 25175; ]
  596.  
  597. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  598. Now for some three-dimensional graphics.
  599. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ]
  600. Plot3D[Sin[x] Sin[3 y] , {x, -2, 2}, {y,-2, 2}]
  601. :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; rightWrapOffset = 431; pictureLeft = 2; pictureTop = 1; pictureWidth = 282; pictureHeight = 231; endGroup; pictureID = 287; ]
  602.  
  603. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  604. Here is a contour plot of the same function.
  605. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ]
  606. Show[ ContourGraphics[ % ], ContourShading -> False,
  607.                             ContourSmoothing -> True]
  608. :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; rightWrapOffset = 431; pictureWidth = 282; pictureHeight = 282; endGroup; pictureID = 29547; ]
  609.  
  610. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  611. This generates a three-dimensional parametric surface.
  612. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ]
  613. ParametricPlot3D[ {u Sin[t], u Cos[t], t/3},
  614.               {t, 0, 12}, {u, -1, 1}, Ticks -> None]
  615. :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; rightWrapOffset = 431; pictureWidth = 157; pictureHeight = 252; endGroup; pictureID = 14838; ]
  616.  
  617. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ]
  618. Mathematica  generates all graphics in PostScript, so that you can resize pictures, and make use of the resolution available on different types of printers. (Note, however, that to save disk space the graphics in this Notebook have been converted into bitmap images, which have lower resolution and do not look as good when resized or printed.  The ability to convert images into bitmap form is useful when space is at a premium, and for animations, which are normally not printed.)
  619. ;[s]
  620. 2:0,1;11,0;483,-1;
  621. 2:1,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0;
  622. :[font = section; inactive; Cclosed; preserveAspect; rightWrapOffset = 431; startGroup; ]
  623. Animated Graphics 
  624. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  625. You can use sequences of graphics cells in a Notebook as frames in a ÒmovieÓ.
  626. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  627. For information on other controls for viewing Mathematica  movies, see the Notebook Read This First!
  628. ;[s]
  629. 5:0,0;46,1;57,0;84,2;100,0;101,-1;
  630. 3:3,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0;1,14,9,Times,1,12,0,0,0;
  631. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  632. This Notebook contains a sample of animation in Mathematica.  Due to disk space limitations, this is a simple black and white example.  Look at the Color Movie Notebook on your disk for an example of animated  color graphics.
  633. ;[s]
  634. 5:0,0;48,1;59,0;148,2;159,0;226,-1;
  635. 3:3,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0;1,14,9,Times,1,12,0,0,0;
  636. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  637. To view the movie:
  638. :[font = text; inactive; preserveAspect; blackDot; leftWrapOffset = 54; rightWrapOffset = 431; ]
  639. Scroll until the first graphics cell is completely visible in the window.  (The movie is shown in this cell.)
  640. :[font = text; inactive; preserveAspect; blackDot; leftWrapOffset = 54; rightWrapOffset = 431; ]
  641. Double-click the first picture in the sequence to start the movie.  Click again anywhere to stop.
  642. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  643. For information on other controls for viewing Mathematica  movies, see the Notebook Read This First!
  644. ;[s]
  645. 4:0,0;46,1;57,0;84,2;101,-1;
  646. 3:2,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0;1,14,9,Times,1,12,0,0,0;
  647. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  648.  
  649. :[font = input; dontPreserveAspect; startGroup; ]
  650. Do[Plot3D[Cos[Sqrt[x^2 + y^2]+Abs[n-2Pi]]/Sqrt[x^2 + y^2 + 1/4],
  651.     {x,-4Pi,4Pi},{y,-4Pi,4Pi},
  652. PlotPoints->26,Lighting->True,PlotRange->{-2,2},
  653. BoxRatios->{1,1,1},Boxed->False,Axes->None],
  654. {n, 0, 2Pi - (2Pi/16), 2Pi/16}]
  655. :[font = postscript; PICT; formatAsPICT; output; inactive; Cclosed; preserveAspect; pictureWidth = 377; pictureHeight = 377; startGroup; pictureID = 723; ]
  656.  
  657. :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; pictureWidth = 377; pictureHeight = 377; pictureID = 24492; ]
  658.  
  659. :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; pictureWidth = 377; pictureHeight = 377; pictureID = 31605; ]
  660.  
  661. :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; pictureWidth = 377; pictureHeight = 377; pictureID = 6708; ]
  662.  
  663. :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; pictureWidth = 377; pictureHeight = 377; pictureID = 26717; ]
  664.  
  665. :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; pictureWidth = 377; pictureHeight = 377; pictureID = 27420; ]
  666.  
  667. :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; pictureWidth = 377; pictureHeight = 377; pictureID = 10921; ]
  668.  
  669. :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; pictureWidth = 377; pictureHeight = 377; pictureID = 12697; ]
  670.  
  671. :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; pictureWidth = 377; pictureHeight = 377; pictureID = 6985; ]
  672.  
  673. :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; pictureWidth = 377; pictureHeight = 377; pictureID = 29613; ]
  674.  
  675. :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; pictureWidth = 377; pictureHeight = 377; pictureID = 28645; ]
  676.  
  677. :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; pictureWidth = 377; pictureHeight = 377; pictureID = 10514; ]
  678.  
  679. :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; pictureWidth = 377; pictureHeight = 377; pictureID = 2807; ]
  680.  
  681. :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; pictureWidth = 377; pictureHeight = 377; pictureID = 6586; ]
  682.  
  683. :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; pictureWidth = 377; pictureHeight = 377; pictureID = 17882; ]
  684.  
  685. :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; pictureWidth = 377; pictureHeight = 377; endGroup; endGroup; endGroup; pictureID = 10876; ]
  686.  
  687. :[font = section; inactive; Cclosed; preserveAspect; rightWrapOffset = 431; startGroup; ]
  688. Sound
  689. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  690. Mathematica  can produce not only graphics but also sound. Just as you can use Plot to plot a function, you can also use Play to ÒplayÓ a function.
  691. ;[s]
  692. 6:0,1;12,0;79,2;83,0;121,2;125,0;148,-1;
  693. 3:3,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0;2,13,9,Courier,1,10,0,0,0;
  694. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  695. To play a sound, double-click the small, speaker-shaped icon at the top of the sound cell bracket.  Note: When you double-click the sound cell itself, Mathematica  treats it as an animated graphic and plays it repeatedly.  To stop, click again anywhere.
  696. ;[s]
  697. 3:0,0;151,1;162,0;254,-1;
  698. 2:2,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0;
  699. :[font = text; inactive; preserveAspect; ]
  700.  
  701. Here are two examples of sound that use frequency modulation.  
  702. In the first example the modulating frequency is in the sub-audio range giving a "vibrato"
  703. effect.
  704. :[font = input; preserveAspect; startGroup; ]
  705. Play[Sin[ 2 Pi 440 t + Sin[ 2 Pi 10 t ] ], {t, 0, 1}]
  706. :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; pictureLeft = 83; pictureWidth = 160; pictureHeight = 98; endGroup; pictureID = 11409; soundID = 23682; ]
  707.  
  708. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  709. This plays a more complex sound.  It is the superposition or sum of two modulated 
  710. waves.
  711. :[font = input; dontPreserveAspect; startGroup; ]
  712. Play[Sin[1000 t Sin[Mod[100 t, 1]]] + 
  713.                 Sin[1000 t ( 1 + 0.1 Sin[100 t])], {t, 0, 3}]
  714. :[font = postscript; PICT; formatAsPICT; output; inactive; dontPreserveAspect; pictureWidth = 374; pictureHeight = 98; endGroup; endGroup; pictureID = 7864; soundID = 23241; ]
  715.  
  716. :[font = section; inactive; Cclosed; preserveAspect; rightWrapOffset = 431; startGroup; ]
  717. Programming in Mathematica  
  718. ;[s]
  719. 3:0,1;15,2;26,1;29,-1;
  720. 3:0,19,13,Courier,1,18,0,0,0;2,20,14,Times,1,18,0,0,0;1,20,14,Times,3,18,0,0,0;
  721. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  722. You can use Mathematica  not only as a ÒcalculatorÓ, but also as a full symbolic programming language.
  723.  
  724. Many application packages covering specific areas have been or are being written in the Mathematica  language.
  725. ;[s]
  726. 6:0,1;0,0;12,1;23,0;192,1;204,0;215,-1;
  727. 2:3,14,9,Times,0,12,0,0,0;3,14,9,Times,2,12,0,0,0;
  728. :[font = subsection; inactive; Cclosed; preserveAspect; rightWrapOffset = 431; startGroup; ]
  729. A Graphics Application Package
  730. :[font = input; preserveAspect; rightWrapOffset = 431; ]
  731. Needs["Graphics`Polyhedra`"]
  732. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  733. This loads in a package that defines properties of polyhedra.
  734. The package defines, among other things, the geometry of a dodecahedron. The Vertices function gives the coordinates for the faces of the given polyhedron.
  735. Here are the vertices for a dodecahedron shown in shortened form.
  736. ;[s]
  737. 3:0,0;139,1;147,0;284,-1;
  738. 2:2,14,9,Times,0,12,0,0,0;1,15,10,B Courier Bold,0,12,0,0,0;
  739. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ]
  740. Vertices[ Dodecahedron ] // Short
  741. :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ]
  742. Short[{{0.5257311121191334, 0.3819660112501049, 0.85065080835204}, 
  743.    {-0.2008114158862271, 0.6180339887498946, 0.85065080835204}, 
  744.    {-0.6498393924658123, 0., 0.85065080835204}, 
  745.    {-0.2008114158862271, -0.6180339887498946, 0.85065080835204}, 
  746.    {0.5257311121191334, -0.3819660112501049, 0.85065080835204}, 
  747.    {0.85065080835204, 0.6180339887498946, 0.2008114158862272}, 
  748.    {-0.3249196962329061, 1., 0.2008114158862272}, 
  749.    {-1.051462224238266, 0., 0.2008114158862272}, 
  750.    {-0.3249196962329061, -1., 0.2008114158862272}, 
  751.    {0.85065080835204, -0.6180339887498946, 0.2008114158862272}, 
  752.    {0.3249196962329061, 1., -0.2008114158862272}, 
  753.    {-0.85065080835204, 0.6180339887498949, -0.2008114158862273}, 
  754.    {-0.85065080835204, -0.6180339887498949, -0.2008114158862273}, 
  755.    {0.3249196962329061, -1., -0.2008114158862272}, 
  756.    {1.051462224238266, 0., -0.2008114158862272}, 
  757.    {0.2008114158862272, 0.6180339887498949, -0.85065080835204}, 
  758.    {-0.5257311121191338, 0.3819660112501051, -0.85065080835204}, 
  759.    {-0.5257311121191338, -0.3819660112501051, -0.85065080835204}, 
  760.    {0.2008114158862272, -0.6180339887498949, -0.85065080835204}, 
  761.    {0.6498393924658127, 0., -0.85065080835204}}]
  762. ;[o]
  763. {{0.525731, 0.381966, 0.850651}, <<18>>, {0.649839, 0., -0.850651}}
  764. :[font = text; inactive; preserveAspect; ]
  765. This shows the dodecahedron as a three-dimensional graphical object.
  766. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ]
  767. Show[ Polyhedron[ Dodecahedron]];
  768. :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; rightWrapOffset = 431; pictureLeft = 50; pictureWidth = 282; pictureHeight = 277; endGroup; pictureID = 23349; ]
  769.  
  770. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  771.  
  772.  
  773. As another example, we can use the definitions from the polyhedra package to create an image of a stellated icosahedron, which is often used as an icon for the Mathematica  system.
  774. ;[s]
  775. 3:0,0;162,1;174,0;183,-1;
  776. 2:2,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0;
  777. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ]
  778. Show[ Stellate[ Polyhedron[ Icosahedron ] ] ] ];
  779. :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; rightWrapOffset = 431; pictureLeft = 50; pictureWidth = 282; pictureHeight = 277; endGroup; endGroup; pictureID = 18089; ]
  780.  
  781. :[font = subsection; inactive; Cclosed; preserveAspect; startGroup; ]
  782. Random Walks
  783. :[font = text; inactive; preserveAspect; ]
  784. These examples illustrate random walks in various dimensions.
  785. Mathematica's  list operations and plotting routines are combined to  give concise 
  786. programs  that  generate and then plot the random walks.
  787. ;[s]
  788. 3:0,0;62,1;73,0;203,-1;
  789. 2:2,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0;
  790. :[font = subsubsection; inactive; preserveAspect; ]
  791. One-Dimensional  Random Walk
  792. ;[s]
  793. 3:0,1;3,0;4,1;29,-1;
  794. 2:1,17,12,Geneva,1,12,0,0,0;2,14,9,Times,1,12,0,0,0;
  795. :[font = input; preserveAspect; ]
  796.  
  797. FoldList[Plus, 0, Table[Random[Real, {-1, 1}], {100}]];
  798. :[font = input; preserveAspect; startGroup; ]
  799. ListPlot[%, PlotJoined->True]
  800. :[font = postscript; PostScript; formatAsPostScript; output; inactive; preserveAspect; pictureLeft = 36; pictureWidth = 266; pictureHeight = 164; endGroup; ]
  801. %!
  802. %%Creator: Mathematica
  803. %%AspectRatio: 0.61803 
  804. MathPictureStart
  805. /Courier findfont 10  scalefont  setfont
  806. % Scaling calculations
  807. 0.0238095 0.00942951 0.0487863 0.0686819 [
  808. [(20)] 0.2124 0.04879 0 2 Msboxa
  809. [(40)] 0.40099 0.04879 0 2 Msboxa
  810. [(60)] 0.58958 0.04879 0 2 Msboxa
  811. [(80)] 0.77817 0.04879 0 2 Msboxa
  812. [(100)] 0.96676 0.04879 0 2 Msboxa
  813. [(2)] 0.01131 0.18615 1 0 Msboxa
  814. [(4)] 0.01131 0.32351 1 0 Msboxa
  815. [(6)] 0.01131 0.46088 1 0 Msboxa
  816. [(8)] 0.01131 0.59824 1 0 Msboxa
  817. [ -0.001 -0.001 0 0 ]
  818. [ 1.001 0.61903 0 0 ]
  819. ] MathScale
  820. % Start of Graphics
  821. 1 setlinecap
  822. 1 setlinejoin
  823. newpath
  824. %%Object: Graphics
  825. [ ] 0 setdash
  826. 0 setgray
  827. gsave
  828. gsave
  829. 0.002 setlinewidth
  830. 0.2124 0.04879 moveto
  831. 0.2124 0.05504 lineto
  832. stroke
  833. grestore
  834. [(20)] 0.2124 0.04879 0 2 Mshowa
  835. gsave
  836. 0.002 setlinewidth
  837. 0.40099 0.04879 moveto
  838. 0.40099 0.05504 lineto
  839. stroke
  840. grestore
  841. [(40)] 0.40099 0.04879 0 2 Mshowa
  842. gsave
  843. 0.002 setlinewidth
  844. 0.58958 0.04879 moveto
  845. 0.58958 0.05504 lineto
  846. stroke
  847. grestore
  848. [(60)] 0.58958 0.04879 0 2 Mshowa
  849. gsave
  850. 0.002 setlinewidth
  851. 0.77817 0.04879 moveto
  852. 0.77817 0.05504 lineto
  853. stroke
  854. grestore
  855. [(80)] 0.77817 0.04879 0 2 Mshowa
  856. gsave
  857. 0.002 setlinewidth
  858. 0.96676 0.04879 moveto
  859. 0.96676 0.05504 lineto
  860. stroke
  861. grestore
  862. [(100)] 0.96676 0.04879 0 2 Mshowa
  863. gsave
  864. 0.001 setlinewidth
  865. 0.06153 0.04879 moveto
  866. 0.06153 0.05254 lineto
  867. stroke
  868. grestore
  869. gsave
  870. 0.001 setlinewidth
  871. 0.09925 0.04879 moveto
  872. 0.09925 0.05254 lineto
  873. stroke
  874. grestore
  875. gsave
  876. 0.001 setlinewidth
  877. 0.13696 0.04879 moveto
  878. 0.13696 0.05254 lineto
  879. stroke
  880. grestore
  881. gsave
  882. 0.001 setlinewidth
  883. 0.17468 0.04879 moveto
  884. 0.17468 0.05254 lineto
  885. stroke
  886. grestore
  887. gsave
  888. 0.001 setlinewidth
  889. 0.25012 0.04879 moveto
  890. 0.25012 0.05254 lineto
  891. stroke
  892. grestore
  893. gsave
  894. 0.001 setlinewidth
  895. 0.28784 0.04879 moveto
  896. 0.28784 0.05254 lineto
  897. stroke
  898. grestore
  899. gsave
  900. 0.001 setlinewidth
  901. 0.32555 0.04879 moveto
  902. 0.32555 0.05254 lineto
  903. stroke
  904. grestore
  905. gsave
  906. 0.001 setlinewidth
  907. 0.36327 0.04879 moveto
  908. 0.36327 0.05254 lineto
  909. stroke
  910. grestore
  911. gsave
  912. 0.001 setlinewidth
  913. 0.43871 0.04879 moveto
  914. 0.43871 0.05254 lineto
  915. stroke
  916. grestore
  917. gsave
  918. 0.001 setlinewidth
  919. 0.47643 0.04879 moveto
  920. 0.47643 0.05254 lineto
  921. stroke
  922. grestore
  923. gsave
  924. 0.001 setlinewidth
  925. 0.51414 0.04879 moveto
  926. 0.51414 0.05254 lineto
  927. stroke
  928. grestore
  929. gsave
  930. 0.001 setlinewidth
  931. 0.55186 0.04879 moveto
  932. 0.55186 0.05254 lineto
  933. stroke
  934. grestore
  935. gsave
  936. 0.001 setlinewidth
  937. 0.6273 0.04879 moveto
  938. 0.6273 0.05254 lineto
  939. stroke
  940. grestore
  941. gsave
  942. 0.001 setlinewidth
  943. 0.66502 0.04879 moveto
  944. 0.66502 0.05254 lineto
  945. stroke
  946. grestore
  947. gsave
  948. 0.001 setlinewidth
  949. 0.70273 0.04879 moveto
  950. 0.70273 0.05254 lineto
  951. stroke
  952. grestore
  953. gsave
  954. 0.001 setlinewidth
  955. 0.74045 0.04879 moveto
  956. 0.74045 0.05254 lineto
  957. stroke
  958. grestore
  959. gsave
  960. 0.001 setlinewidth
  961. 0.81589 0.04879 moveto
  962. 0.81589 0.05254 lineto
  963. stroke
  964. grestore
  965. gsave
  966. 0.001 setlinewidth
  967. 0.85361 0.04879 moveto
  968. 0.85361 0.05254 lineto
  969. stroke
  970. grestore
  971. gsave
  972. 0.001 setlinewidth
  973. 0.89132 0.04879 moveto
  974. 0.89132 0.05254 lineto
  975. stroke
  976. grestore
  977. gsave
  978. 0.001 setlinewidth
  979. 0.92904 0.04879 moveto
  980. 0.92904 0.05254 lineto
  981. stroke
  982. grestore
  983. gsave
  984. 0.002 setlinewidth
  985. 0 0.04879 moveto
  986. 1 0.04879 lineto
  987. stroke
  988. grestore
  989. gsave
  990. 0.002 setlinewidth
  991. 0.02381 0.18615 moveto
  992. 0.03006 0.18615 lineto
  993. stroke
  994. grestore
  995. [(2)] 0.01131 0.18615 1 0 Mshowa
  996. gsave
  997. 0.002 setlinewidth
  998. 0.02381 0.32351 moveto
  999. 0.03006 0.32351 lineto
  1000. stroke
  1001. grestore
  1002. [(4)] 0.01131 0.32351 1 0 Mshowa
  1003. gsave
  1004. 0.002 setlinewidth
  1005. 0.02381 0.46088 moveto
  1006. 0.03006 0.46088 lineto
  1007. stroke
  1008. grestore
  1009. [(6)] 0.01131 0.46088 1 0 Mshowa
  1010. gsave
  1011. 0.002 setlinewidth
  1012. 0.02381 0.59824 moveto
  1013. 0.03006 0.59824 lineto
  1014. stroke
  1015. grestore
  1016. [(8)] 0.01131 0.59824 1 0 Mshowa
  1017. gsave
  1018. 0.001 setlinewidth
  1019. 0.02381 0.07626 moveto
  1020. 0.02756 0.07626 lineto
  1021. stroke
  1022. grestore
  1023. gsave
  1024. 0.001 setlinewidth
  1025. 0.02381 0.10373 moveto
  1026. 0.02756 0.10373 lineto
  1027. stroke
  1028. grestore
  1029. gsave
  1030. 0.001 setlinewidth
  1031. 0.02381 0.1312 moveto
  1032. 0.02756 0.1312 lineto
  1033. stroke
  1034. grestore
  1035. gsave
  1036. 0.001 setlinewidth
  1037. 0.02381 0.15868 moveto
  1038. 0.02756 0.15868 lineto
  1039. stroke
  1040. grestore
  1041. gsave
  1042. 0.001 setlinewidth
  1043. 0.02381 0.21362 moveto
  1044. 0.02756 0.21362 lineto
  1045. stroke
  1046. grestore
  1047. gsave
  1048. 0.001 setlinewidth
  1049. 0.02381 0.2411 moveto
  1050. 0.02756 0.2411 lineto
  1051. stroke
  1052. grestore
  1053. gsave
  1054. 0.001 setlinewidth
  1055. 0.02381 0.26857 moveto
  1056. 0.02756 0.26857 lineto
  1057. stroke
  1058. grestore
  1059. gsave
  1060. 0.001 setlinewidth
  1061. 0.02381 0.29604 moveto
  1062. 0.02756 0.29604 lineto
  1063. stroke
  1064. grestore
  1065. gsave
  1066. 0.001 setlinewidth
  1067. 0.02381 0.35099 moveto
  1068. 0.02756 0.35099 lineto
  1069. stroke
  1070. grestore
  1071. gsave
  1072. 0.001 setlinewidth
  1073. 0.02381 0.37846 moveto
  1074. 0.02756 0.37846 lineto
  1075. stroke
  1076. grestore
  1077. gsave
  1078. 0.001 setlinewidth
  1079. 0.02381 0.40593 moveto
  1080. 0.02756 0.40593 lineto
  1081. stroke
  1082. grestore
  1083. gsave
  1084. 0.001 setlinewidth
  1085. 0.02381 0.4334 moveto
  1086. 0.02756 0.4334 lineto
  1087. stroke
  1088. grestore
  1089. gsave
  1090. 0.001 setlinewidth
  1091. 0.02381 0.48835 moveto
  1092. 0.02756 0.48835 lineto
  1093. stroke
  1094. grestore
  1095. gsave
  1096. 0.001 setlinewidth
  1097. 0.02381 0.51582 moveto
  1098. 0.02756 0.51582 lineto
  1099. stroke
  1100. grestore
  1101. gsave
  1102. 0.001 setlinewidth
  1103. 0.02381 0.5433 moveto
  1104. 0.02756 0.5433 lineto
  1105. stroke
  1106. grestore
  1107. gsave
  1108. 0.001 setlinewidth
  1109. 0.02381 0.57077 moveto
  1110. 0.02756 0.57077 lineto
  1111. stroke
  1112. grestore
  1113. gsave
  1114. 0.001 setlinewidth
  1115. 0.02381 0.02131 moveto
  1116. 0.02756 0.02131 lineto
  1117. stroke
  1118. grestore
  1119. gsave
  1120. 0.002 setlinewidth
  1121. 0.02381 0 moveto
  1122. 0.02381 0.61803 lineto
  1123. stroke
  1124. grestore
  1125. grestore
  1126. 0 0 moveto
  1127. 1 0 lineto
  1128. 1 0.61803 lineto
  1129. 0 0.61803 lineto
  1130. closepath
  1131. clip
  1132. newpath
  1133. 0.004 setlinewidth
  1134. 0.03324 0.04879 moveto
  1135. 0.04267 0.02962 lineto
  1136. 0.0521 0.02466 lineto
  1137. 0.06153 0.03041 lineto
  1138. 0.07096 0.03661 lineto
  1139. 0.08039 0.01472 lineto
  1140. 0.08982 0.07515 lineto
  1141. 0.09925 0.14202 lineto
  1142. 0.10868 0.09754 lineto
  1143. 0.1181 0.03656 lineto
  1144. 0.12753 0.09946 lineto
  1145. 0.13696 0.10628 lineto
  1146. 0.14639 0.13475 lineto
  1147. 0.15582 0.13862 lineto
  1148. 0.16525 0.19873 lineto
  1149. 0.17468 0.25545 lineto
  1150. 0.18411 0.29712 lineto
  1151. 0.19354 0.34977 lineto
  1152. 0.20297 0.29631 lineto
  1153. 0.2124 0.26082 lineto
  1154. 0.22183 0.28129 lineto
  1155. 0.23126 0.32458 lineto
  1156. 0.24069 0.26758 lineto
  1157. 0.25012 0.33569 lineto
  1158. 0.25955 0.3783 lineto
  1159. 0.26898 0.34565 lineto
  1160. 0.27841 0.34639 lineto
  1161. 0.28784 0.33001 lineto
  1162. 0.29727 0.31472 lineto
  1163. 0.30669 0.3455 lineto
  1164. 0.31612 0.35608 lineto
  1165. 0.32555 0.40588 lineto
  1166. 0.33498 0.41727 lineto
  1167. 0.34441 0.44679 lineto
  1168. 0.35384 0.42433 lineto
  1169. 0.36327 0.4525 lineto
  1170. 0.3727 0.48276 lineto
  1171. 0.38213 0.54358 lineto
  1172. 0.39156 0.54632 lineto
  1173. 0.40099 0.49097 lineto
  1174. 0.41042 0.46254 lineto
  1175. 0.41985 0.51893 lineto
  1176. 0.42928 0.50179 lineto
  1177. 0.43871 0.50259 lineto
  1178. 0.44814 0.43427 lineto
  1179. 0.45757 0.38894 lineto
  1180. 0.467 0.32327 lineto
  1181. 0.47643 0.31404 lineto
  1182. 0.48586 0.32983 lineto
  1183. 0.49529 0.31385 lineto
  1184. Mistroke
  1185. 0.50471 0.35473 lineto
  1186. 0.51414 0.36692 lineto
  1187. 0.52357 0.38266 lineto
  1188. 0.533 0.3399 lineto
  1189. 0.54243 0.37123 lineto
  1190. 0.55186 0.42819 lineto
  1191. 0.56129 0.47255 lineto
  1192. 0.57072 0.40906 lineto
  1193. 0.58015 0.38004 lineto
  1194. 0.58958 0.35984 lineto
  1195. 0.59901 0.41925 lineto
  1196. 0.60844 0.47652 lineto
  1197. 0.61787 0.41156 lineto
  1198. 0.6273 0.38924 lineto
  1199. 0.63673 0.34056 lineto
  1200. 0.64616 0.33456 lineto
  1201. 0.65559 0.30088 lineto
  1202. 0.66502 0.35523 lineto
  1203. 0.67445 0.36456 lineto
  1204. 0.68388 0.40414 lineto
  1205. 0.69331 0.37005 lineto
  1206. 0.70273 0.37282 lineto
  1207. 0.71216 0.37001 lineto
  1208. 0.72159 0.43313 lineto
  1209. 0.73102 0.48561 lineto
  1210. 0.74045 0.49987 lineto
  1211. 0.74988 0.53564 lineto
  1212. 0.75931 0.60332 lineto
  1213. 0.76874 0.5595 lineto
  1214. 0.77817 0.51863 lineto
  1215. 0.7876 0.47133 lineto
  1216. 0.79703 0.43143 lineto
  1217. 0.80646 0.36297 lineto
  1218. 0.81589 0.39202 lineto
  1219. 0.82532 0.41123 lineto
  1220. 0.83475 0.35529 lineto
  1221. 0.84418 0.40279 lineto
  1222. 0.85361 0.45655 lineto
  1223. 0.86304 0.44594 lineto
  1224. 0.87247 0.47973 lineto
  1225. 0.8819 0.44349 lineto
  1226. 0.89132 0.38265 lineto
  1227. 0.90075 0.37926 lineto
  1228. 0.91018 0.34271 lineto
  1229. 0.91961 0.28927 lineto
  1230. 0.92904 0.23603 lineto
  1231. 0.93847 0.16852 lineto
  1232. 0.9479 0.18481 lineto
  1233. 0.95733 0.13821 lineto
  1234. 0.96676 0.20657 lineto
  1235. Mistroke
  1236. 0.97619 0.20915 lineto
  1237. Mfstroke
  1238. % End of Graphics
  1239. MathPictureEnd
  1240. :[font = subsubsection; inactive; preserveAspect; ]
  1241. Two-Dimensional  Random Walk
  1242. ;[s]
  1243. 1:0,1;29,-1;
  1244. 2:0,17,12,Geneva,1,12,0,0,0;1,14,9,Times,1,12,0,0,0;
  1245. :[font = input; preserveAspect; ]
  1246. FoldList[Plus, {0, 0}, Table[Random[Real, {-1, 1}], {100}, {2}]];
  1247. :[font = input; preserveAspect; startGroup; ]
  1248. ListPlot[%, PlotJoined->True]
  1249. :[font = postscript; PostScript; formatAsPostScript; output; inactive; preserveAspect; pictureLeft = 36; pictureWidth = 266; pictureHeight = 164; endGroup; ]
  1250. %!
  1251. %%Creator: Mathematica
  1252. %%AspectRatio: 0.61803 
  1253. MathPictureStart
  1254. /Courier findfont 10  scalefont  setfont
  1255. % Scaling calculations
  1256. 0.532661 0.0974204 0.0461965 0.0468417 [
  1257. [(-4)] 0.14298 0.0462 0 2 Msboxa
  1258. [(-2)] 0.33782 0.0462 0 2 Msboxa
  1259. [(2)] 0.7275 0.0462 0 2 Msboxa
  1260. [(4)] 0.92234 0.0462 0 2 Msboxa
  1261. [(2)] 0.52016 0.13988 1 0 Msboxa
  1262. [(4)] 0.52016 0.23356 1 0 Msboxa
  1263. [(6)] 0.52016 0.32725 1 0 Msboxa
  1264. [(8)] 0.52016 0.42093 1 0 Msboxa
  1265. [(10)] 0.52016 0.51461 1 0 Msboxa
  1266. [(12)] 0.52016 0.6083 1 0 Msboxa
  1267. [ -0.001 -0.001 0 0 ]
  1268. [ 1.001 0.61903 0 0 ]
  1269. ] MathScale
  1270. % Start of Graphics
  1271. 1 setlinecap
  1272. 1 setlinejoin
  1273. newpath
  1274. %%Object: Graphics
  1275. [ ] 0 setdash
  1276. 0 setgray
  1277. gsave
  1278. gsave
  1279. 0.002 setlinewidth
  1280. 0.14298 0.0462 moveto
  1281. 0.14298 0.05245 lineto
  1282. stroke
  1283. grestore
  1284. [(-4)] 0.14298 0.0462 0 2 Mshowa
  1285. gsave
  1286. 0.002 setlinewidth
  1287. 0.33782 0.0462 moveto
  1288. 0.33782 0.05245 lineto
  1289. stroke
  1290. grestore
  1291. [(-2)] 0.33782 0.0462 0 2 Mshowa
  1292. gsave
  1293. 0.002 setlinewidth
  1294. 0.7275 0.0462 moveto
  1295. 0.7275 0.05245 lineto
  1296. stroke
  1297. grestore
  1298. [(2)] 0.7275 0.0462 0 2 Mshowa
  1299. gsave
  1300. 0.002 setlinewidth
  1301. 0.92234 0.0462 moveto
  1302. 0.92234 0.05245 lineto
  1303. stroke
  1304. grestore
  1305. [(4)] 0.92234 0.0462 0 2 Mshowa
  1306. gsave
  1307. 0.001 setlinewidth
  1308. 0.18195 0.0462 moveto
  1309. 0.18195 0.04995 lineto
  1310. stroke
  1311. grestore
  1312. gsave
  1313. 0.001 setlinewidth
  1314. 0.22092 0.0462 moveto
  1315. 0.22092 0.04995 lineto
  1316. stroke
  1317. grestore
  1318. gsave
  1319. 0.001 setlinewidth
  1320. 0.25988 0.0462 moveto
  1321. 0.25988 0.04995 lineto
  1322. stroke
  1323. grestore
  1324. gsave
  1325. 0.001 setlinewidth
  1326. 0.29885 0.0462 moveto
  1327. 0.29885 0.04995 lineto
  1328. stroke
  1329. grestore
  1330. gsave
  1331. 0.001 setlinewidth
  1332. 0.37679 0.0462 moveto
  1333. 0.37679 0.04995 lineto
  1334. stroke
  1335. grestore
  1336. gsave
  1337. 0.001 setlinewidth
  1338. 0.41576 0.0462 moveto
  1339. 0.41576 0.04995 lineto
  1340. stroke
  1341. grestore
  1342. gsave
  1343. 0.001 setlinewidth
  1344. 0.45472 0.0462 moveto
  1345. 0.45472 0.04995 lineto
  1346. stroke
  1347. grestore
  1348. gsave
  1349. 0.001 setlinewidth
  1350. 0.49369 0.0462 moveto
  1351. 0.49369 0.04995 lineto
  1352. stroke
  1353. grestore
  1354. gsave
  1355. 0.001 setlinewidth
  1356. 0.57163 0.0462 moveto
  1357. 0.57163 0.04995 lineto
  1358. stroke
  1359. grestore
  1360. gsave
  1361. 0.001 setlinewidth
  1362. 0.6106 0.0462 moveto
  1363. 0.6106 0.04995 lineto
  1364. stroke
  1365. grestore
  1366. gsave
  1367. 0.001 setlinewidth
  1368. 0.64957 0.0462 moveto
  1369. 0.64957 0.04995 lineto
  1370. stroke
  1371. grestore
  1372. gsave
  1373. 0.001 setlinewidth
  1374. 0.68853 0.0462 moveto
  1375. 0.68853 0.04995 lineto
  1376. stroke
  1377. grestore
  1378. gsave
  1379. 0.001 setlinewidth
  1380. 0.76647 0.0462 moveto
  1381. 0.76647 0.04995 lineto
  1382. stroke
  1383. grestore
  1384. gsave
  1385. 0.001 setlinewidth
  1386. 0.80544 0.0462 moveto
  1387. 0.80544 0.04995 lineto
  1388. stroke
  1389. grestore
  1390. gsave
  1391. 0.001 setlinewidth
  1392. 0.84441 0.0462 moveto
  1393. 0.84441 0.04995 lineto
  1394. stroke
  1395. grestore
  1396. gsave
  1397. 0.001 setlinewidth
  1398. 0.88337 0.0462 moveto
  1399. 0.88337 0.04995 lineto
  1400. stroke
  1401. grestore
  1402. gsave
  1403. 0.001 setlinewidth
  1404. 0.10401 0.0462 moveto
  1405. 0.10401 0.04995 lineto
  1406. stroke
  1407. grestore
  1408. gsave
  1409. 0.001 setlinewidth
  1410. 0.06504 0.0462 moveto
  1411. 0.06504 0.04995 lineto
  1412. stroke
  1413. grestore
  1414. gsave
  1415. 0.001 setlinewidth
  1416. 0.02607 0.0462 moveto
  1417. 0.02607 0.04995 lineto
  1418. stroke
  1419. grestore
  1420. gsave
  1421. 0.001 setlinewidth
  1422. 0.96131 0.0462 moveto
  1423. 0.96131 0.04995 lineto
  1424. stroke
  1425. grestore
  1426. gsave
  1427. 0.002 setlinewidth
  1428. 0 0.0462 moveto
  1429. 1 0.0462 lineto
  1430. stroke
  1431. grestore
  1432. gsave
  1433. 0.002 setlinewidth
  1434. 0.53266 0.13988 moveto
  1435. 0.53891 0.13988 lineto
  1436. stroke
  1437. grestore
  1438. [(2)] 0.52016 0.13988 1 0 Mshowa
  1439. gsave
  1440. 0.002 setlinewidth
  1441. 0.53266 0.23356 moveto
  1442. 0.53891 0.23356 lineto
  1443. stroke
  1444. grestore
  1445. [(4)] 0.52016 0.23356 1 0 Mshowa
  1446. gsave
  1447. 0.002 setlinewidth
  1448. 0.53266 0.32725 moveto
  1449. 0.53891 0.32725 lineto
  1450. stroke
  1451. grestore
  1452. [(6)] 0.52016 0.32725 1 0 Mshowa
  1453. gsave
  1454. 0.002 setlinewidth
  1455. 0.53266 0.42093 moveto
  1456. 0.53891 0.42093 lineto
  1457. stroke
  1458. grestore
  1459. [(8)] 0.52016 0.42093 1 0 Mshowa
  1460. gsave
  1461. 0.002 setlinewidth
  1462. 0.53266 0.51461 moveto
  1463. 0.53891 0.51461 lineto
  1464. stroke
  1465. grestore
  1466. [(10)] 0.52016 0.51461 1 0 Mshowa
  1467. gsave
  1468. 0.002 setlinewidth
  1469. 0.53266 0.6083 moveto
  1470. 0.53891 0.6083 lineto
  1471. stroke
  1472. grestore
  1473. [(12)] 0.52016 0.6083 1 0 Mshowa
  1474. gsave
  1475. 0.001 setlinewidth
  1476. 0.53266 0.06493 moveto
  1477. 0.53641 0.06493 lineto
  1478. stroke
  1479. grestore
  1480. gsave
  1481. 0.001 setlinewidth
  1482. 0.53266 0.08367 moveto
  1483. 0.53641 0.08367 lineto
  1484. stroke
  1485. grestore
  1486. gsave
  1487. 0.001 setlinewidth
  1488. 0.53266 0.10241 moveto
  1489. 0.53641 0.10241 lineto
  1490. stroke
  1491. grestore
  1492. gsave
  1493. 0.001 setlinewidth
  1494. 0.53266 0.12114 moveto
  1495. 0.53641 0.12114 lineto
  1496. stroke
  1497. grestore
  1498. gsave
  1499. 0.001 setlinewidth
  1500. 0.53266 0.15862 moveto
  1501. 0.53641 0.15862 lineto
  1502. stroke
  1503. grestore
  1504. gsave
  1505. 0.001 setlinewidth
  1506. 0.53266 0.17735 moveto
  1507. 0.53641 0.17735 lineto
  1508. stroke
  1509. grestore
  1510. gsave
  1511. 0.001 setlinewidth
  1512. 0.53266 0.19609 moveto
  1513. 0.53641 0.19609 lineto
  1514. stroke
  1515. grestore
  1516. gsave
  1517. 0.001 setlinewidth
  1518. 0.53266 0.21483 moveto
  1519. 0.53641 0.21483 lineto
  1520. stroke
  1521. grestore
  1522. gsave
  1523. 0.001 setlinewidth
  1524. 0.53266 0.2523 moveto
  1525. 0.53641 0.2523 lineto
  1526. stroke
  1527. grestore
  1528. gsave
  1529. 0.001 setlinewidth
  1530. 0.53266 0.27104 moveto
  1531. 0.53641 0.27104 lineto
  1532. stroke
  1533. grestore
  1534. gsave
  1535. 0.001 setlinewidth
  1536. 0.53266 0.28977 moveto
  1537. 0.53641 0.28977 lineto
  1538. stroke
  1539. grestore
  1540. gsave
  1541. 0.001 setlinewidth
  1542. 0.53266 0.30851 moveto
  1543. 0.53641 0.30851 lineto
  1544. stroke
  1545. grestore
  1546. gsave
  1547. 0.001 setlinewidth
  1548. 0.53266 0.34598 moveto
  1549. 0.53641 0.34598 lineto
  1550. stroke
  1551. grestore
  1552. gsave
  1553. 0.001 setlinewidth
  1554. 0.53266 0.36472 moveto
  1555. 0.53641 0.36472 lineto
  1556. stroke
  1557. grestore
  1558. gsave
  1559. 0.001 setlinewidth
  1560. 0.53266 0.38346 moveto
  1561. 0.53641 0.38346 lineto
  1562. stroke
  1563. grestore
  1564. gsave
  1565. 0.001 setlinewidth
  1566. 0.53266 0.40219 moveto
  1567. 0.53641 0.40219 lineto
  1568. stroke
  1569. grestore
  1570. gsave
  1571. 0.001 setlinewidth
  1572. 0.53266 0.43967 moveto
  1573. 0.53641 0.43967 lineto
  1574. stroke
  1575. grestore
  1576. gsave
  1577. 0.001 setlinewidth
  1578. 0.53266 0.4584 moveto
  1579. 0.53641 0.4584 lineto
  1580. stroke
  1581. grestore
  1582. gsave
  1583. 0.001 setlinewidth
  1584. 0.53266 0.47714 moveto
  1585. 0.53641 0.47714 lineto
  1586. stroke
  1587. grestore
  1588. gsave
  1589. 0.001 setlinewidth
  1590. 0.53266 0.49588 moveto
  1591. 0.53641 0.49588 lineto
  1592. stroke
  1593. grestore
  1594. gsave
  1595. 0.001 setlinewidth
  1596. 0.53266 0.53335 moveto
  1597. 0.53641 0.53335 lineto
  1598. stroke
  1599. grestore
  1600. gsave
  1601. 0.001 setlinewidth
  1602. 0.53266 0.55209 moveto
  1603. 0.53641 0.55209 lineto
  1604. stroke
  1605. grestore
  1606. gsave
  1607. 0.001 setlinewidth
  1608. 0.53266 0.57082 moveto
  1609. 0.53641 0.57082 lineto
  1610. stroke
  1611. grestore
  1612. gsave
  1613. 0.001 setlinewidth
  1614. 0.53266 0.58956 moveto
  1615. 0.53641 0.58956 lineto
  1616. stroke
  1617. grestore
  1618. gsave
  1619. 0.001 setlinewidth
  1620. 0.53266 0.02746 moveto
  1621. 0.53641 0.02746 lineto
  1622. stroke
  1623. grestore
  1624. gsave
  1625. 0.001 setlinewidth
  1626. 0.53266 0.00872 moveto
  1627. 0.53641 0.00872 lineto
  1628. stroke
  1629. grestore
  1630. gsave
  1631. 0.002 setlinewidth
  1632. 0.53266 0 moveto
  1633. 0.53266 0.61803 lineto
  1634. stroke
  1635. grestore
  1636. grestore
  1637. 0 0 moveto
  1638. 1 0 lineto
  1639. 1 0.61803 lineto
  1640. 0 0.61803 lineto
  1641. closepath
  1642. clip
  1643. newpath
  1644. 0.004 setlinewidth
  1645. 0.53266 0.0462 moveto
  1646. 0.61164 0.05392 lineto
  1647. 0.52274 0.05703 lineto
  1648. 0.61988 0.09643 lineto
  1649. 0.59489 0.07959 lineto
  1650. 0.59569 0.11785 lineto
  1651. 0.62475 0.16134 lineto
  1652. 0.59908 0.20794 lineto
  1653. 0.51055 0.23963 lineto
  1654. 0.47312 0.23876 lineto
  1655. 0.48882 0.19704 lineto
  1656. 0.42328 0.17619 lineto
  1657. 0.36513 0.16653 lineto
  1658. 0.35876 0.14583 lineto
  1659. 0.31753 0.13688 lineto
  1660. 0.32381 0.15577 lineto
  1661. 0.34039 0.16017 lineto
  1662. 0.25306 0.13678 lineto
  1663. 0.29406 0.18099 lineto
  1664. 0.19714 0.17422 lineto
  1665. 0.19285 0.13894 lineto
  1666. 0.13929 0.16452 lineto
  1667. 0.11983 0.16545 lineto
  1668. 0.06333 0.17336 lineto
  1669. 0.08138 0.14942 lineto
  1670. 0.17566 0.17014 lineto
  1671. 0.12613 0.1387 lineto
  1672. 0.04143 0.17588 lineto
  1673. 0.06921 0.1775 lineto
  1674. 0.02381 0.21877 lineto
  1675. 0.05801 0.17792 lineto
  1676. 0.14037 0.13186 lineto
  1677. 0.14486 0.17173 lineto
  1678. 0.12102 0.18613 lineto
  1679. 0.04314 0.15502 lineto
  1680. 0.10322 0.13041 lineto
  1681. 0.15923 0.09221 lineto
  1682. 0.12632 0.11941 lineto
  1683. 0.0579 0.09581 lineto
  1684. 0.13747 0.09722 lineto
  1685. 0.10137 0.12084 lineto
  1686. 0.12323 0.08392 lineto
  1687. 0.12471 0.0848 lineto
  1688. 0.17034 0.05914 lineto
  1689. 0.14295 0.05035 lineto
  1690. 0.16642 0.038 lineto
  1691. 0.16824 0.01472 lineto
  1692. 0.23145 0.05142 lineto
  1693. 0.30803 0.0908 lineto
  1694. 0.29227 0.08498 lineto
  1695. Mistroke
  1696. 0.30232 0.13147 lineto
  1697. 0.22481 0.12052 lineto
  1698. 0.17724 0.09381 lineto
  1699. 0.13631 0.13729 lineto
  1700. 0.19346 0.1514 lineto
  1701. 0.28943 0.17512 lineto
  1702. 0.2403 0.15106 lineto
  1703. 0.26948 0.16705 lineto
  1704. 0.33271 0.19037 lineto
  1705. 0.29017 0.21045 lineto
  1706. 0.33712 0.18966 lineto
  1707. 0.41715 0.20529 lineto
  1708. 0.36416 0.1979 lineto
  1709. 0.28477 0.24051 lineto
  1710. 0.34494 0.24472 lineto
  1711. 0.42671 0.26447 lineto
  1712. 0.41988 0.28268 lineto
  1713. 0.49937 0.27231 lineto
  1714. 0.48202 0.27341 lineto
  1715. 0.49643 0.2553 lineto
  1716. 0.58173 0.2631 lineto
  1717. 0.58991 0.29096 lineto
  1718. 0.53472 0.33199 lineto
  1719. 0.512 0.3586 lineto
  1720. 0.50492 0.32491 lineto
  1721. 0.5912 0.32778 lineto
  1722. 0.65641 0.33521 lineto
  1723. 0.60032 0.33428 lineto
  1724. 0.57164 0.33619 lineto
  1725. 0.58218 0.34068 lineto
  1726. 0.64086 0.31889 lineto
  1727. 0.70825 0.3128 lineto
  1728. 0.66131 0.33754 lineto
  1729. 0.67909 0.37184 lineto
  1730. 0.71918 0.36817 lineto
  1731. 0.72455 0.36702 lineto
  1732. 0.70945 0.38689 lineto
  1733. 0.69773 0.34417 lineto
  1734. 0.79034 0.33959 lineto
  1735. 0.70833 0.31527 lineto
  1736. 0.66054 0.36169 lineto
  1737. 0.62615 0.4023 lineto
  1738. 0.68898 0.437 lineto
  1739. 0.74051 0.48343 lineto
  1740. 0.81051 0.50707 lineto
  1741. 0.83602 0.53505 lineto
  1742. 0.85022 0.53655 lineto
  1743. 0.92534 0.51903 lineto
  1744. 0.96291 0.55581 lineto
  1745. 0.97619 0.55852 lineto
  1746. Mistroke
  1747. 0.91461 0.60332 lineto
  1748. Mfstroke
  1749. % End of Graphics
  1750. MathPictureEnd
  1751. :[font = subsubsection; inactive; preserveAspect; ]
  1752. Three-Dimensional  Random Walk
  1753. ;[s]
  1754. 1:0,1;31,-1;
  1755. 2:0,17,12,Geneva,1,12,0,0,0;1,14,9,Times,1,12,0,0,0;
  1756. :[font = input; preserveAspect; ]
  1757. FoldList[Plus, {0, 0, 0}, Table[Random[Real, {-1, 1}], {100}, {3}]];
  1758. :[font = input; preserveAspect; startGroup; ]
  1759. Show[Graphics3D[Line[%]]]
  1760.  
  1761. :[font = postscript; PostScript; formatAsPostScript; output; inactive; preserveAspect; pictureLeft = 36; pictureWidth = 242; pictureHeight = 270; endGroup; endGroup; ]
  1762. %!
  1763. %%Creator: Mathematica
  1764. %%AspectRatio: 1.11356 
  1765. MathPictureStart
  1766. /Courier findfont 10  scalefont  setfont
  1767. % Scaling calculations
  1768. -0.038545 1.13871 0.0284677 1.13871 [
  1769. [ 0 0 0 0 ]
  1770. [ 1 1.11356 0 0 ]
  1771. ] MathScale
  1772. % Start of Graphics
  1773. 1 setlinecap
  1774. 1 setlinejoin
  1775. newpath
  1776. %%Object: Graphics3D
  1777. [ ] 0 setdash
  1778. 0 setgray
  1779. 0 0 moveto
  1780. 1 0 lineto
  1781. 1 1.11356 lineto
  1782. 0 1.11356 lineto
  1783. closepath
  1784. clip
  1785. newpath
  1786. gsave
  1787. 0.002 setlinewidth
  1788. 0.0993 0.24101 moveto
  1789. 0.02847 0.7525 lineto
  1790. stroke
  1791. 0.02847 0.7525 moveto
  1792. 0.45855 1.0851 lineto
  1793. stroke
  1794. 0.45855 1.0851 moveto
  1795. 0.46698 0.62263 lineto
  1796. stroke
  1797. 0.46698 0.62263 moveto
  1798. 0.0993 0.24101 lineto
  1799. stroke
  1800. 0.61524 0.02847 moveto
  1801. 0.91605 0.4792 lineto
  1802. stroke
  1803. 0.91605 0.4792 moveto
  1804. 0.97153 0.96226 lineto
  1805. stroke
  1806. 0.97153 0.96226 moveto
  1807. 0.63067 0.55901 lineto
  1808. stroke
  1809. 0.63067 0.55901 moveto
  1810. 0.61524 0.02847 lineto
  1811. stroke
  1812. 0.0993 0.24101 moveto
  1813. 0.02847 0.7525 lineto
  1814. stroke
  1815. 0.02847 0.7525 moveto
  1816. 0.63067 0.55901 lineto
  1817. stroke
  1818. 0.63067 0.55901 moveto
  1819. 0.61524 0.02847 lineto
  1820. stroke
  1821. 0.61524 0.02847 moveto
  1822. 0.0993 0.24101 lineto
  1823. stroke
  1824. 0.46698 0.62263 moveto
  1825. 0.91605 0.4792 lineto
  1826. stroke
  1827. 0.91605 0.4792 moveto
  1828. 0.97153 0.96226 lineto
  1829. stroke
  1830. 0.97153 0.96226 moveto
  1831. 0.45855 1.0851 lineto
  1832. stroke
  1833. 0.45855 1.0851 moveto
  1834. 0.46698 0.62263 lineto
  1835. stroke
  1836. grestore
  1837. gsave
  1838. 0.004 setlinewidth
  1839. 0.42129 0.51719 moveto
  1840. 0.43166 0.48655 lineto
  1841. stroke
  1842. grestore
  1843. gsave
  1844. 0.004 setlinewidth
  1845. 0.35479 0.51971 moveto
  1846. 0.42129 0.51719 lineto
  1847. stroke
  1848. grestore
  1849. gsave
  1850. 0.004 setlinewidth
  1851. 0.3279 0.55289 moveto
  1852. 0.35479 0.51971 lineto
  1853. stroke
  1854. grestore
  1855. gsave
  1856. 0.004 setlinewidth
  1857. 0.45491 0.5491 moveto
  1858. 0.39821 0.55312 lineto
  1859. stroke
  1860. grestore
  1861. gsave
  1862. 0.004 setlinewidth
  1863. 0.48476 0.56392 moveto
  1864. 0.45491 0.5491 lineto
  1865. stroke
  1866. grestore
  1867. gsave
  1868. 0.004 setlinewidth
  1869. 0.50424 0.49169 moveto
  1870. 0.41848 0.443 lineto
  1871. stroke
  1872. grestore
  1873. gsave
  1874. 0.004 setlinewidth
  1875. 0.79368 0.62206 moveto
  1876. 0.77851 0.62562 lineto
  1877. stroke
  1878. grestore
  1879. gsave
  1880. 0.004 setlinewidth
  1881. 0.81926 0.63286 moveto
  1882. 0.79368 0.62206 lineto
  1883. stroke
  1884. grestore
  1885. gsave
  1886. 0.004 setlinewidth
  1887. 0.39821 0.55312 moveto
  1888. 0.3279 0.55289 lineto
  1889. stroke
  1890. grestore
  1891. gsave
  1892. 0.004 setlinewidth
  1893. 0.78854 0.68064 moveto
  1894. 0.8192 0.65011 lineto
  1895. stroke
  1896. grestore
  1897. gsave
  1898. 0.004 setlinewidth
  1899. 0.72785 0.65001 moveto
  1900. 0.78854 0.68064 lineto
  1901. stroke
  1902. grestore
  1903. gsave
  1904. 0.004 setlinewidth
  1905. 0.43166 0.48655 moveto
  1906. 0.50424 0.49169 lineto
  1907. stroke
  1908. grestore
  1909. gsave
  1910. 0.004 setlinewidth
  1911. 0.7613 0.67084 moveto
  1912. 0.72785 0.65001 lineto
  1913. stroke
  1914. grestore
  1915. gsave
  1916. 0.004 setlinewidth
  1917. 0.42929 0.49644 moveto
  1918. 0.44376 0.53394 lineto
  1919. stroke
  1920. grestore
  1921. gsave
  1922. 0.004 setlinewidth
  1923. 0.47535 0.46911 moveto
  1924. 0.42929 0.49644 lineto
  1925. stroke
  1926. grestore
  1927. gsave
  1928. 0.004 setlinewidth
  1929. 0.44376 0.53394 moveto
  1930. 0.45306 0.51319 lineto
  1931. stroke
  1932. grestore
  1933. gsave
  1934. 0.004 setlinewidth
  1935. 0.52963 0.49811 moveto
  1936. 0.47535 0.46911 lineto
  1937. stroke
  1938. grestore
  1939. gsave
  1940. 0.004 setlinewidth
  1941. 0.45306 0.51319 moveto
  1942. 0.48476 0.56392 lineto
  1943. stroke
  1944. grestore
  1945. gsave
  1946. 0.004 setlinewidth
  1947. 0.56957 0.49488 moveto
  1948. 0.50187 0.47203 lineto
  1949. stroke
  1950. grestore
  1951. gsave
  1952. 0.004 setlinewidth
  1953. 0.54683 0.49645 moveto
  1954. 0.56957 0.49488 lineto
  1955. stroke
  1956. grestore
  1957. gsave
  1958. 0.004 setlinewidth
  1959. 0.90293 0.6536 moveto
  1960. 0.81926 0.63286 lineto
  1961. stroke
  1962. grestore
  1963. gsave
  1964. 0.004 setlinewidth
  1965. 0.8192 0.65011 moveto
  1966. 0.90293 0.6536 lineto
  1967. stroke
  1968. grestore
  1969. gsave
  1970. 0.004 setlinewidth
  1971. 0.77851 0.62562 moveto
  1972. 0.73298 0.62002 lineto
  1973. stroke
  1974. grestore
  1975. gsave
  1976. 0.004 setlinewidth
  1977. 0.50187 0.47203 moveto
  1978. 0.52963 0.49811 lineto
  1979. stroke
  1980. grestore
  1981. gsave
  1982. 0.004 setlinewidth
  1983. 0.70471 0.68255 moveto
  1984. 0.73276 0.67066 lineto
  1985. stroke
  1986. grestore
  1987. gsave
  1988. 0.004 setlinewidth
  1989. 0.62414 0.71972 moveto
  1990. 0.70471 0.68255 lineto
  1991. stroke
  1992. grestore
  1993. gsave
  1994. 0.004 setlinewidth
  1995. 0.73276 0.67066 moveto
  1996. 0.7613 0.67084 lineto
  1997. stroke
  1998. grestore
  1999. gsave
  2000. 0.004 setlinewidth
  2001. 0.62831 0.52492 moveto
  2002. 0.54683 0.49645 lineto
  2003. stroke
  2004. grestore
  2005. gsave
  2006. 0.004 setlinewidth
  2007. 0.62462 0.53431 moveto
  2008. 0.62831 0.52492 lineto
  2009. stroke
  2010. grestore
  2011. gsave
  2012. 0.004 setlinewidth
  2013. 0.60495 0.76854 moveto
  2014. 0.62414 0.71972 lineto
  2015. stroke
  2016. grestore
  2017. gsave
  2018. 0.004 setlinewidth
  2019. 0.73298 0.62002 moveto
  2020. 0.7032 0.63741 lineto
  2021. stroke
  2022. grestore
  2023. gsave
  2024. 0.004 setlinewidth
  2025. 0.44396 0.52946 moveto
  2026. 0.35764 0.53905 lineto
  2027. stroke
  2028. grestore
  2029. gsave
  2030. 0.004 setlinewidth
  2031. 0.49673 0.57431 moveto
  2032. 0.44396 0.52946 lineto
  2033. stroke
  2034. grestore
  2035. gsave
  2036. 0.004 setlinewidth
  2037. 0.64455 0.77669 moveto
  2038. 0.60495 0.76854 lineto
  2039. stroke
  2040. grestore
  2041. gsave
  2042. 0.004 setlinewidth
  2043. 0.61964 0.65015 moveto
  2044. 0.57263 0.58092 lineto
  2045. stroke
  2046. grestore
  2047. gsave
  2048. 0.004 setlinewidth
  2049. 0.6177 0.63292 moveto
  2050. 0.61964 0.65015 lineto
  2051. stroke
  2052. grestore
  2053. gsave
  2054. 0.004 setlinewidth
  2055. 0.57263 0.58092 moveto
  2056. 0.49673 0.57431 lineto
  2057. stroke
  2058. grestore
  2059. gsave
  2060. 0.004 setlinewidth
  2061. 0.69813 0.66498 moveto
  2062. 0.67097 0.68467 lineto
  2063. stroke
  2064. grestore
  2065. gsave
  2066. 0.004 setlinewidth
  2067. 0.68695 0.6046 moveto
  2068. 0.69813 0.66498 lineto
  2069. stroke
  2070. grestore
  2071. gsave
  2072. 0.004 setlinewidth
  2073. 0.74018 0.56421 moveto
  2074. 0.68695 0.6046 lineto
  2075. stroke
  2076. grestore
  2077. gsave
  2078. 0.004 setlinewidth
  2079. 0.68411 0.55623 moveto
  2080. 0.74018 0.56421 lineto
  2081. stroke
  2082. grestore
  2083. gsave
  2084. 0.004 setlinewidth
  2085. 0.57388 0.55993 moveto
  2086. 0.64773 0.60362 lineto
  2087. stroke
  2088. grestore
  2089. gsave
  2090. 0.004 setlinewidth
  2091. 0.60371 0.59145 moveto
  2092. 0.57388 0.55993 lineto
  2093. stroke
  2094. grestore
  2095. gsave
  2096. 0.004 setlinewidth
  2097. 0.61885 0.66043 moveto
  2098. 0.60371 0.59145 lineto
  2099. stroke
  2100. grestore
  2101. gsave
  2102. 0.004 setlinewidth
  2103. 0.60192 0.63018 moveto
  2104. 0.61885 0.66043 lineto
  2105. stroke
  2106. grestore
  2107. gsave
  2108. 0.004 setlinewidth
  2109. 0.35764 0.53905 moveto
  2110. 0.29898 0.58854 lineto
  2111. stroke
  2112. grestore
  2113. gsave
  2114. 0.004 setlinewidth
  2115. 0.67097 0.68467 moveto
  2116. 0.6177 0.63292 lineto
  2117. stroke
  2118. grestore
  2119. gsave
  2120. 0.004 setlinewidth
  2121. 0.64773 0.60362 moveto
  2122. 0.69948 0.5775 lineto
  2123. stroke
  2124. grestore
  2125. gsave
  2126. 0.004 setlinewidth
  2127. 0.7032 0.63741 moveto
  2128. 0.68411 0.55623 lineto
  2129. stroke
  2130. grestore
  2131. gsave
  2132. 0.004 setlinewidth
  2133. 0.7298 0.58276 moveto
  2134. 0.67726 0.53162 lineto
  2135. stroke
  2136. grestore
  2137. gsave
  2138. 0.004 setlinewidth
  2139. 0.7105 0.58836 moveto
  2140. 0.7298 0.58276 lineto
  2141. stroke
  2142. grestore
  2143. gsave
  2144. 0.004 setlinewidth
  2145. 0.29898 0.58854 moveto
  2146. 0.37373 0.62749 lineto
  2147. stroke
  2148. grestore
  2149. gsave
  2150. 0.004 setlinewidth
  2151. 0.67726 0.53162 moveto
  2152. 0.62462 0.53431 lineto
  2153. stroke
  2154. grestore
  2155. gsave
  2156. 0.004 setlinewidth
  2157. 0.63891 0.80129 moveto
  2158. 0.64455 0.77669 lineto
  2159. stroke
  2160. grestore
  2161. gsave
  2162. 0.004 setlinewidth
  2163. 0.4328 0.63675 moveto
  2164. 0.41946 0.57405 lineto
  2165. stroke
  2166. grestore
  2167. gsave
  2168. 0.004 setlinewidth
  2169. 0.37373 0.62749 moveto
  2170. 0.4328 0.63675 lineto
  2171. stroke
  2172. grestore
  2173. gsave
  2174. 0.004 setlinewidth
  2175. 0.60427 0.66042 moveto
  2176. 0.60192 0.63018 lineto
  2177. stroke
  2178. grestore
  2179. gsave
  2180. 0.004 setlinewidth
  2181. 0.65401 0.58936 moveto
  2182. 0.7105 0.58836 lineto
  2183. stroke
  2184. grestore
  2185. gsave
  2186. 0.004 setlinewidth
  2187. 0.69948 0.5775 moveto
  2188. 0.65401 0.58936 lineto
  2189. stroke
  2190. grestore
  2191. gsave
  2192. 0.004 setlinewidth
  2193. 0.45992 0.50175 moveto
  2194. 0.48209 0.49971 lineto
  2195. stroke
  2196. grestore
  2197. gsave
  2198. 0.004 setlinewidth
  2199. 0.41946 0.57405 moveto
  2200. 0.45992 0.50175 lineto
  2201. stroke
  2202. grestore
  2203. gsave
  2204. 0.004 setlinewidth
  2205. 0.53135 0.63243 moveto
  2206. 0.60427 0.66042 lineto
  2207. stroke
  2208. grestore
  2209. gsave
  2210. 0.004 setlinewidth
  2211. 0.5713 0.5606 moveto
  2212. 0.53135 0.63243 lineto
  2213. stroke
  2214. grestore
  2215. gsave
  2216. 0.004 setlinewidth
  2217. 0.63884 0.68023 moveto
  2218. 0.58635 0.65571 lineto
  2219. stroke
  2220. grestore
  2221. gsave
  2222. 0.004 setlinewidth
  2223. 0.62034 0.66469 moveto
  2224. 0.63884 0.68023 lineto
  2225. stroke
  2226. grestore
  2227. gsave
  2228. 0.004 setlinewidth
  2229. 0.61318 0.52733 moveto
  2230. 0.5713 0.5606 lineto
  2231. stroke
  2232. grestore
  2233. gsave
  2234. 0.004 setlinewidth
  2235. 0.49712 0.44358 moveto
  2236. 0.52988 0.48896 lineto
  2237. stroke
  2238. grestore
  2239. gsave
  2240. 0.004 setlinewidth
  2241. 0.53853 0.4536 moveto
  2242. 0.49712 0.44358 lineto
  2243. stroke
  2244. grestore
  2245. gsave
  2246. 0.004 setlinewidth
  2247. 0.58635 0.65571 moveto
  2248. 0.66854 0.72616 lineto
  2249. stroke
  2250. grestore
  2251. gsave
  2252. 0.004 setlinewidth
  2253. 0.66854 0.72616 moveto
  2254. 0.63891 0.80129 lineto
  2255. stroke
  2256. grestore
  2257. gsave
  2258. 0.004 setlinewidth
  2259. 0.5372 0.4841 moveto
  2260. 0.53853 0.4536 lineto
  2261. stroke
  2262. grestore
  2263. gsave
  2264. 0.004 setlinewidth
  2265. 0.48209 0.49971 moveto
  2266. 0.5372 0.4841 lineto
  2267. stroke
  2268. grestore
  2269. gsave
  2270. 0.004 setlinewidth
  2271. 0.6585 0.68045 moveto
  2272. 0.62034 0.66469 lineto
  2273. stroke
  2274. grestore
  2275. gsave
  2276. 0.004 setlinewidth
  2277. 0.6113 0.67891 moveto
  2278. 0.6585 0.68045 lineto
  2279. stroke
  2280. grestore
  2281. gsave
  2282. 0.004 setlinewidth
  2283. 0.67533 0.72684 moveto
  2284. 0.6113 0.67891 lineto
  2285. stroke
  2286. grestore
  2287. gsave
  2288. 0.004 setlinewidth
  2289. 0.52988 0.48896 moveto
  2290. 0.61318 0.52733 lineto
  2291. stroke
  2292. grestore
  2293. gsave
  2294. 0.004 setlinewidth
  2295. 0.60526 0.80874 moveto
  2296. 0.67533 0.72684 lineto
  2297. stroke
  2298. grestore
  2299. gsave
  2300. 0.004 setlinewidth
  2301. 0.62946 0.70296 moveto
  2302. 0.60526 0.80874 lineto
  2303. stroke
  2304. grestore
  2305. gsave
  2306. 0.004 setlinewidth
  2307. 0.63892 0.59819 moveto
  2308. 0.62946 0.70296 lineto
  2309. stroke
  2310. grestore
  2311. gsave
  2312. 0.004 setlinewidth
  2313. 0.63296 0.53689 moveto
  2314. 0.63892 0.59819 lineto
  2315. stroke
  2316. grestore
  2317. gsave
  2318. 0.004 setlinewidth
  2319. 0.57352 0.46781 moveto
  2320. 0.63296 0.53689 lineto
  2321. stroke
  2322. grestore
  2323. gsave
  2324. 0.004 setlinewidth
  2325. 0.56979 0.46994 moveto
  2326. 0.57352 0.46781 lineto
  2327. stroke
  2328. grestore
  2329. gsave
  2330. 0.004 setlinewidth
  2331. 0.49417 0.4618 moveto
  2332. 0.51317 0.46662 lineto
  2333. stroke
  2334. grestore
  2335. gsave
  2336. 0.004 setlinewidth
  2337. 0.50834 0.48232 moveto
  2338. 0.49417 0.4618 lineto
  2339. stroke
  2340. grestore
  2341. gsave
  2342. 0.004 setlinewidth
  2343. 0.48562 0.56845 moveto
  2344. 0.53845 0.5741 lineto
  2345. stroke
  2346. grestore
  2347. gsave
  2348. 0.004 setlinewidth
  2349. 0.50017 0.57389 moveto
  2350. 0.48562 0.56845 lineto
  2351. stroke
  2352. grestore
  2353. gsave
  2354. 0.004 setlinewidth
  2355. 0.55119 0.48146 moveto
  2356. 0.56979 0.46994 lineto
  2357. stroke
  2358. grestore
  2359. gsave
  2360. 0.004 setlinewidth
  2361. 0.50666 0.52652 moveto
  2362. 0.56908 0.53454 lineto
  2363. stroke
  2364. grestore
  2365. gsave
  2366. 0.004 setlinewidth
  2367. 0.49551 0.57633 moveto
  2368. 0.50666 0.52652 lineto
  2369. stroke
  2370. grestore
  2371. gsave
  2372. 0.004 setlinewidth
  2373. 0.53072 0.48353 moveto
  2374. 0.49551 0.57633 lineto
  2375. stroke
  2376. grestore
  2377. gsave
  2378. 0.004 setlinewidth
  2379. 0.56908 0.53454 moveto
  2380. 0.55119 0.48146 lineto
  2381. stroke
  2382. grestore
  2383. gsave
  2384. 0.004 setlinewidth
  2385. 0.6159 0.6073 moveto
  2386. 0.68483 0.55892 lineto
  2387. stroke
  2388. grestore
  2389. gsave
  2390. 0.004 setlinewidth
  2391. 0.59366 0.6578 moveto
  2392. 0.6159 0.6073 lineto
  2393. stroke
  2394. grestore
  2395. gsave
  2396. 0.004 setlinewidth
  2397. 0.48847 0.47621 moveto
  2398. 0.50017 0.57389 lineto
  2399. stroke
  2400. grestore
  2401. gsave
  2402. 0.004 setlinewidth
  2403. 0.51317 0.46662 moveto
  2404. 0.48847 0.47621 lineto
  2405. stroke
  2406. grestore
  2407. gsave
  2408. 0.004 setlinewidth
  2409. 0.57118 0.43323 moveto
  2410. 0.50834 0.48232 lineto
  2411. stroke
  2412. grestore
  2413. gsave
  2414. 0.004 setlinewidth
  2415. 0.5052 0.54787 moveto
  2416. 0.53072 0.48353 lineto
  2417. stroke
  2418. grestore
  2419. gsave
  2420. 0.004 setlinewidth
  2421. 0.68483 0.55892 moveto
  2422. 0.61838 0.54469 lineto
  2423. stroke
  2424. grestore
  2425. gsave
  2426. 0.004 setlinewidth
  2427. 0.61838 0.54469 moveto
  2428. 0.57118 0.43323 lineto
  2429. stroke
  2430. grestore
  2431. gsave
  2432. 0.004 setlinewidth
  2433. 0.53845 0.5741 moveto
  2434. 0.5052 0.54787 lineto
  2435. stroke
  2436. grestore
  2437. gsave
  2438. 0.002 setlinewidth
  2439. 0.61524 0.02847 moveto
  2440. 0.91605 0.4792 lineto
  2441. stroke
  2442. 0.91605 0.4792 moveto
  2443. 0.97153 0.96226 lineto
  2444. stroke
  2445. 0.97153 0.96226 moveto
  2446. 0.63067 0.55901 lineto
  2447. stroke
  2448. 0.63067 0.55901 moveto
  2449. 0.61524 0.02847 lineto
  2450. stroke
  2451. 0.0993 0.24101 moveto
  2452. 0.02847 0.7525 lineto
  2453. stroke
  2454. 0.02847 0.7525 moveto
  2455. 0.63067 0.55901 lineto
  2456. stroke
  2457. 0.63067 0.55901 moveto
  2458. 0.61524 0.02847 lineto
  2459. stroke
  2460. 0.61524 0.02847 moveto
  2461. 0.0993 0.24101 lineto
  2462. stroke
  2463. grestore
  2464. gsave
  2465. grestore
  2466. % End of Graphics
  2467. MathPictureEnd
  2468. :[font = subsection; inactive; Cclosed; preserveAspect; rightWrapOffset = 431; startGroup; ]
  2469. More on Programming
  2470. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  2471. There are several styles of programming in Mathematica.  One of them is procedural programming, as you would find in a standard structured programming language such as C or Pascal.
  2472.  
  2473. Another is Òrule-based programmingÓ.  The idea is to give transformation rules which specify how Mathematica  should transform expressions it receives as input. 
  2474.  
  2475. You can give rules that mimic the formulas you might find in a mathematics textbook.
  2476.  
  2477. Here is an example of how you might teach Mathematica  about a new form of logarithm function, called nlog.
  2478. ;[s]
  2479. 9:0,0;43,1;54,0;279,1;290,0;473,1;484,0;533,2;537,0;539,-1;
  2480. 3:5,14,9,Times,0,12,0,0,0;3,14,9,Times,2,12,0,0,0;1,13,9,Courier,1,10,0,0,0;
  2481. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ]
  2482. nlog[a b c d^2]
  2483. :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ]
  2484. nlog[a*b*c*d^2]
  2485. ;[o]
  2486.             2
  2487. nlog[a b c d ]
  2488. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  2489. Mathematica  initially knows nothing about our new function, so it does nothing to expressions involving nlog.
  2490. ;[s]
  2491. 4:0,1;12,0;105,2;109,0;111,-1;
  2492. 3:2,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0;1,13,9,Courier,1,10,0,0,0;
  2493. :[font = input; preserveAspect; rightWrapOffset = 431; ]
  2494. nlog[x_ y_] := nlog[x] + nlog[y]
  2495. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  2496. This tells Mathematica  how to expand out logarithms of products.
  2497. ;[s]
  2498. 3:0,0;11,1;22,0;66,-1;
  2499. 2:2,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0;
  2500. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ]
  2501. nlog[a b c d^2]
  2502. :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ]
  2503. nlog[a] + nlog[b] + nlog[c] + nlog[d^2]
  2504. ;[o]
  2505.                                     2
  2506. nlog[a] + nlog[b] + nlog[c] + nlog[d ]
  2507. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  2508. Now Mathematica  can expand the nlog out. 
  2509. ;[s]
  2510. 5:0,0;4,1;15,0;32,2;36,0;43,-1;
  2511. 3:3,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0;1,13,9,Courier,1,10,0,0,0;
  2512. :[font = input; preserveAspect; rightWrapOffset = 431; ]
  2513. nlog[x_^n_] := n nlog[x]
  2514. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  2515. This gives a rule for nlog of a power.
  2516. ;[s]
  2517. 3:0,0;22,1;26,0;39,-1;
  2518. 2:2,14,9,Times,0,12,0,0,0;1,13,9,Courier,1,10,0,0,0;
  2519. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ]
  2520. nlog[a b c d^2]
  2521. :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ]
  2522. nlog[a] + nlog[b] + nlog[c] + 2*nlog[d]
  2523. ;[o]
  2524. nlog[a] + nlog[b] + nlog[c] + 2 nlog[d]
  2525. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  2526. Now Mathematica  can expand the expression out completely.
  2527. ;[s]
  2528. 3:0,0;4,1;15,0;59,-1;
  2529. 2:2,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0;
  2530. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  2531. Another style of programming you can use in Mathematica  is functional programming.  In functional programming, you specify a collection of functions to apply.  This style of programming often yields compact, elegant programs that make good use of Mathematica's many integrated capabilities.
  2532. ;[s]
  2533. 5:0,0;44,1;55,0;248,1;259,0;292,-1;
  2534. 2:3,14,9,Times,0,12,0,0,0;2,14,9,Times,2,12,0,0,0;
  2535. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  2536. This is a program that plots the solutions to a polynomial equation as points in the complex plane.
  2537. :[font = input; preserveAspect; rightWrapOffset = 431; ]
  2538. RootPlot[poly_, z] :=
  2539.   ListPlot[{Re[z], Im[z]} /. NSolve[ poly == 0, z],
  2540.                         AspectRatio -> Automatic ]                                 
  2541. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  2542. You can immediately use the program to plot solutions.
  2543. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ]
  2544. RootPlot[ z^7 - 1 , z];
  2545. :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; rightWrapOffset = 431; pictureLeft = 17; pictureWidth = 279; pictureHeight = 287; endGroup; pictureID = 26961; ]
  2546.  
  2547. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  2548. Here is a program written in functional programming style, which finds the first n terms in the continued fraction decomposition of the number x.
  2549. :[font = input; preserveAspect; rightWrapOffset = 431; ]
  2550. ContinuedFraction[x_Real, n_Integer] :=
  2551.  Floor[ NestList[ 
  2552.      Function[{u}, 1/(u - Floor[u])], x, n - 1] ] 
  2553. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ]
  2554. ContinuedFraction[.34252515, 7]
  2555. :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; endGroup; endGroup; ]
  2556. The Unformatted text for this cell was not generated.
  2557. Use options in the Actions Settings dialog box to control
  2558. when Unformatted text is generated.
  2559. ;[o]
  2560. {0, 2, 1, 11, 2, 2, 1}
  2561. :[font = section; inactive; Cclosed; preserveAspect; rightWrapOffset = 431; startGroup; ]
  2562. The Mathematica User Interface
  2563. ;[s]
  2564. 3:0,1;4,2;15,1;31,-1;
  2565. 3:0,19,13,Courier,1,18,0,0,0;2,20,14,Times,1,18,0,0,0;1,20,14,Times,3,18,0,0,0;
  2566. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  2567. Mathematica  consists of two parts Ñ the ÒkernelÓ, which actually does computations, and the Òfront endÓ, which deals with interaction with the user.  The kernel of Mathematica  is essentially the same on all computers that support Mathematica.  The front end, on the other hand, works differently on different kinds of computer. 
  2568.  
  2569. On the Macintosh, Mathematica  has a sophisticated front end that takes advantage of the Macintosh's unique user interface capabilities.  (You can actually use the Macintosh front end even if you are using a Òremote kernelÓ, say on a supercomputer connected through a network.)
  2570. ;[s]
  2571. 8:0,1;11,0;165,1;176,0;232,1;243,0;350,1;361,0;610,-1;
  2572. 2:4,14,9,Times,0,12,0,0,0;4,14,9,Times,2,12,0,0,0;
  2573. :[font = subsection; inactive; preserveAspect; rightWrapOffset = 431; startGroup; ]
  2574. Notebooks
  2575. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  2576. One of the most important aspects of the Macintosh front end is its ability to support Mathematica  ÒNotebooksÓ.  
  2577.  
  2578. This file is an example of a Notebook.  Notebooks consist of a mixture of text, graphics, sounds and Mathematica  input.
  2579.  
  2580. Notebooks can be used like Òinteractive textbooksÓ Ñ you read the text in the Notebook, then use the Mathematica  input in the Notebook to perform calculations.
  2581. ;[s]
  2582. 7:0,0;87,1;98,0;217,1;229,0;339,1;350,0;399,-1;
  2583. 2:4,14,9,Times,0,12,0,0,0;3,14,9,Times,2,12,0,0,0;
  2584. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  2585. Here is a sample Mathematica  Notebook called Point Plots and Space Curves.  
  2586. ;[s]
  2587. 5:0,0;17,1;29,0;46,2;74,0;78,-1;
  2588. 3:3,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0;1,14,9,Times,1,12,0,0,0;
  2589. :[font = title; inactive; Cclosed; preserveAspect; rightWrapOffset = 431; fontName = "B Helvetica Bold"startGroup; ]
  2590. Point Plots and Space Curves
  2591. by Theodore W. Gray
  2592. ;[s]
  2593. 4:0,1;28,0;29,2;48,0;49,-1;
  2594. 3:2,24,17,Courier,1,24,0,0,0;1,18,12,B Helvetica Bold,1,14,0,0,0;1,15,10,B Helvetica Bold,3,12,0,0,0;
  2595. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  2596. This Notebook defines the functions PointPlot, PointPlot3D, PointParamPlot3D, SpaceCurve, and PointSpaceCurve.  These functions let you make discrete point plots in two and three dimensions.  The SpaceCurve and PointSpaceCurve functions let you make three-dimensional functions of one parameter (lines or points in 3D).
  2597. ;[s]
  2598. 11:0,0;36,1;45,0;47,1;58,0;60,1;76,0;78,1;88,0;94,1;109,0;320,-1;
  2599. 2:6,14,9,Times,0,12,0,0,0;5,14,9,Times,1,12,0,0,0;
  2600. :[font = section; inactive; preserveAspect; rightWrapOffset = 431; startGroup; ]
  2601. Examples
  2602. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  2603. Each of the functions defined in this Notebook is a variation of either Plot, Plot3D, or ParametricPlot3D.  The arguments are quite similar to these standard functions.  
  2604. Following are descriptions of each of the functions.
  2605. ;[s]
  2606. 7:0,0;72,1;76,0;78,1;84,0;89,1;105,0;224,-1;
  2607. 2:4,14,9,Times,0,12,0,0,0;3,13,9,Times,1,10,0,0,0;
  2608. :[font = subsection; inactive; Cclosed; preserveAspect; rightWrapOffset = 431; startGroup; ]
  2609. PointPlot
  2610. ;[s]
  2611. 2:0,1;9,0;10,-1;
  2612. 2:1,20,14,Geneva,1,14,0,0,0;1,17,12,Times,1,14,0,0,0;
  2613. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  2614. PointPlot[ f, {x, min, max, (step)}] produces a plot of f(x) vs. x.  Here is an example:
  2615. ;[s]
  2616. 3:0,0;61,1;64,0;89,-1;
  2617. 2:2,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0;
  2618. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ]
  2619. PointPlot[Sin[x], {x, 0, 2 Pi, 0.2}]
  2620. :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; rightWrapOffset = 431; pictureLeft = 67; pictureWidth = 243; pictureHeight = 147; pictureID = 8261; ]
  2621.  
  2622. :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; endGroup; ]
  2623. The Unformatted text for this cell was not generated.
  2624. Use options in the Actions Settings dialog box to control
  2625. when Unformatted text is generated.
  2626. ;[o]
  2627. -Graphics-
  2628. :[font = subsection; inactive; Cclosed; preserveAspect; rightWrapOffset = 431; startGroup; ]
  2629. PointPlot3D
  2630. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  2631.      PointPlot3D[ f, {x, min, max, (step)}, {y, min, max, (step)}] produces a plot of f(x, y), plotted with points instead of surfaces.
  2632. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ]
  2633. PointPlot3D[x y, {x, -4, 4, 0.5}, {y, -4, 4, 0.5}, 
  2634.             BoxRatios->{1,1,1}]
  2635. :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; rightWrapOffset = 431; pictureLeft = 107; pictureWidth = 202; pictureHeight = 198; pictureID = 8228; ]
  2636.  
  2637. :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; endGroup; ]
  2638. The Unformatted text for this cell was not generated.
  2639. Use options in the Actions Settings dialog box to control
  2640. when Unformatted text is generated.
  2641. ;[o]
  2642. -Graphics3D-
  2643. :[font = subsection; inactive; Cclosed; preserveAspect; rightWrapOffset = 431; startGroup; ]
  2644. PointParamPlot3D
  2645. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  2646.      PointParamPlot3D[{x,y,z}, {u, min, max, (step)}, {v, min, max, (step)}] produces a parametric plot of (x(u,v), y(u,v), z(u,v)), plotted with points instead of surfaces.
  2647. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ]
  2648. PointParamPlot3D[{Sin[u] Cos[v], 
  2649.                         Sin[u] Sin[v], Cos[u]}, 
  2650.         {u, 0, Pi, Pi/15}, {v, 0, 2 Pi, Pi/15}, 
  2651.         BoxRatios->{1,1,1}]
  2652. :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; rightWrapOffset = 431; pictureLeft = 113; pictureWidth = 205; pictureHeight = 201; pictureID = 28252; ]
  2653.  
  2654. :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; endGroup; ]
  2655. The Unformatted text for this cell was not generated.
  2656. Use options in the Actions Settings dialog box to control
  2657. when Unformatted text is generated.
  2658. ;[o]
  2659. -Graphics3D-
  2660. :[font = subsection; inactive; Cclosed; preserveAspect; rightWrapOffset = 431; startGroup; ]
  2661. SpaceCurve
  2662. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  2663.      SpaceCurve[{x,y,z}, {u, min, max, (step)}] produces a parametric plot of (x(u), y(u), z(u)), with the calculated points connected by straight lines.
  2664. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ]
  2665. SpaceCurve[{u Sin[u], u Cos[u], u}, 
  2666.            {u, 0, 15, 0.15}, BoxRatios->{1,1,1}]
  2667. :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; rightWrapOffset = 431; pictureLeft = 107; pictureWidth = 202; pictureHeight = 198; pictureID = 14918; ]
  2668.  
  2669. :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; endGroup; ]
  2670. The Unformatted text for this cell was not generated.
  2671. Use options in the Actions Settings dialog box to control
  2672. when Unformatted text is generated.
  2673. ;[o]
  2674. -Graphics3D-
  2675. :[font = subsection; inactive; Cclosed; preserveAspect; rightWrapOffset = 431; startGroup; ]
  2676. PointSpaceCurve
  2677. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ]
  2678.     PointSpaceCurve[{x,y,z}, {u, min, max, (step)}] produces a parametric plot of (x(u), y(u), z(u)), with the calculated points shown as dots.
  2679. :[font = input; Cclosed; preserveAspect; rightWrapOffset = 431; startGroup; ]
  2680. PointSpaceCurve[{u Sin[u], u Cos[u], u^2}, 
  2681.             {u, 0, 15, 0.30}, BoxRatios->{1,1,1}]
  2682. :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; rightWrapOffset = 431; pictureLeft = 114; pictureWidth = 198; pictureHeight = 194; pictureID = 23298; ]
  2683.  
  2684. :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; endGroup; endGroup; ]
  2685. The Unformatted text for this cell was not generated.
  2686. Use options in the Actions Settings dialog box to control
  2687. when Unformatted text is generated.
  2688. ;[o]
  2689. -Graphics3D-
  2690. :[font = section; inactive; Cclosed; pageBreak; preserveAspect; rightWrapOffset = 431; startGroup; ]
  2691. Implementation
  2692. :[font = text; inactive; Cclosed; preserveAspect; rightWrapOffset = 431; startGroup; ]
  2693. Remove previous definitions for the functions defined in this file:
  2694. :[font = input; preserveAspect; rightWrapOffset = 431; endGroup; ]
  2695. Remove[PointPlot, PointParamPlot3D, PointPlot3D,
  2696.         SpaceCurve, PointSpaceCurve];
  2697. :[font = text; inactive; Cclosed; preserveAspect; rightWrapOffset = 431; startGroup; ]
  2698. Begin this package:
  2699. :[font = input; preserveAspect; rightWrapOffset = 431; endGroup; ]
  2700. BeginPackage["PointPlots`"];
  2701. :[font = text; inactive; Cclosed; preserveAspect; rightWrapOffset = 431; startGroup; ]
  2702. Define the usage strings for each of the functions:
  2703. :[font = input; preserveAspect; rightWrapOffset = 431; ]
  2704. PointPlot::usage =
  2705.     "PointPlot[f, {u, u0, u1, (du)}], (options)] \
  2706.     produces a 2D plot made out of points. \
  2707.     Options are passed to Show[]";
  2708. :[font = input; preserveAspect; rightWrapOffset = 431; ]
  2709. PointPlot3D::usage =
  2710.     "PointPlot3D[f, {x, x0, x1, (dx)}, \
  2711.     {y, y0, y1, (dy)}, (options)] \
  2712.     produces a 3D plot made out of points. \
  2713.     Options are passed to Show[]";
  2714. :[font = input; preserveAspect; rightWrapOffset = 431; ]
  2715. PointParamPlot3D::usage =
  2716.     "PointParamPlot3D[{x, y, z}, {u, u0, u1, (du)}, \
  2717.     {v, v0, v1, (dv)}, (options)] \
  2718.     produces a 3D parametric plot made out of points. \ 
  2719.     Options are passed to Show[]";
  2720. :[font = input; preserveAspect; rightWrapOffset = 431; ]
  2721. SpaceCurve::usage =
  2722.     "SpaceCurve[{x, y, z}, {u, u0, u1, (du)}, \
  2723.     (options)] \
  2724.     produces a 3D space curve. \
  2725.     Options are passed to Show[]";
  2726. :[font = input; preserveAspect; rightWrapOffset = 431; endGroup; ]
  2727. PointSpaceCurve::usage =
  2728.     "PointSpaceCurve[{x, y, z}, \
  2729.     {u, u0, u1, (du)}, (options)] \
  2730.     produces a set of points in 3D. \
  2731.     Options are passed to Show[]";
  2732. :[font = text; inactive; Cclosed; preserveAspect; rightWrapOffset = 431; startGroup; ]
  2733. Begin the private part of this package:
  2734. :[font = input; preserveAspect; rightWrapOffset = 431; endGroup; ]
  2735. Begin["`Private`"];
  2736. `plotpoints = PlotPoints /. Options[Plot3D]; 
  2737. :[font = text; inactive; Cclosed; preserveAspect; rightWrapOffset = 431; startGroup; ]
  2738. Define PointPlot:
  2739. :[font = input; preserveAspect; rightWrapOffset = 431; endGroup; ]
  2740. Attributes[PointPlot] = {HoldFirst};
  2741.  
  2742. PointPlot[function_, range:{x_,___}, options___] := 
  2743.             ListPlot[Table[{x, function}, range], options];
  2744. :[font = text; inactive; Cclosed; preserveAspect; rightWrapOffset = 431; startGroup; ]
  2745. Define PointParamPlot3D:
  2746. :[font = input; preserveAspect; rightWrapOffset = 431; endGroup; ]
  2747. Attributes[PointParamPlot3D] = {HoldFirst};
  2748.  
  2749. PointParamPlot3D[fun:{_, _, _}, 
  2750.     {u_, u0_, u1_, du_:((u1-u0)/(plotpoints-1))}, 
  2751.     {v_, v0_, v1_, dv_:((v1-v0)/(plotpoints-1))}, opts___] :=
  2752.     Show[Graphics3D[Table[Point[N[fun]], 
  2753.                         {u, u0, u1, du}, 
  2754.                         {v, v0, v1, dv}]], opts];
  2755. :[font = text; inactive; Cclosed; preserveAspect; rightWrapOffset = 431; startGroup; ]
  2756. Define PointPlot3D (in terms of PointParamPlot3D):
  2757. :[font = input; preserveAspect; rightWrapOffset = 431; endGroup; ]
  2758. Attributes[PointPlot3D] = {HoldFirst};
  2759.  
  2760. PointPlot3D[fun_, ulim:{u_, ___}, vlim:{v_, ___}, opts___] :=
  2761.     PointParamPlot3D[ {u, v, fun}, ulim, vlim, opts];
  2762. :[font = text; inactive; Cclosed; preserveAspect; rightWrapOffset = 431; startGroup; ]
  2763. Define SpaceCurve:
  2764. :[font = input; preserveAspect; rightWrapOffset = 431; endGroup; ]
  2765. Attributes[SpaceCurve] = {HoldFirst};
  2766.  
  2767. SpaceCurve[fun:{_, _, _}, 
  2768.   {u_, u0_, u1_, du_:((u1-u0)/(plotpoints-1))}, opts___] :=
  2769.     Show[Graphics3D[Line[Table[N[fun], 
  2770.                          {u,u0,u1,du}]]], opts];
  2771. :[font = text; inactive; Cclosed; preserveAspect; rightWrapOffset = 431; startGroup; ]
  2772. Define PointSpaceCurve:
  2773. :[font = input; preserveAspect; rightWrapOffset = 431; endGroup; ]
  2774. Attributes[PointSpaceCurve] = {HoldFirst}
  2775.  
  2776. PointSpaceCurve[fun:{_, _, _}, 
  2777.   {u_, u0_, u1_, du_:((u1-u0)/(plotpoints-1))}, opts___] :=
  2778.     Show[Graphics3D[Table[Point[N[fun]], 
  2779.                     {u,u0,u1,du}]], opts];
  2780. :[font = text; inactive; Cclosed; preserveAspect; rightWrapOffset = 431; startGroup; ]
  2781. End this package:
  2782. :[font = input; preserveAspect; rightWrapOffset = 431; endGroup; endGroup; endGroup; endGroup; endGroup; endGroup; ]
  2783. End[];
  2784. EndPackage[];
  2785. ^*)